#include
#include
#include
#define LL long long
#define min(a,b) ((a
#define max(a,b) ((a>b)?a:b)
#define fo(i,j,k) for(int i=j;i<=k;i++)
#define fd(i,j,k) for(int i=j;i>=k;i--)
using namespace std;
int const maxn=1e6,maxa=1e6;
int t;LL n,a,b;
LL gcd(LL a,LL b){
LL c;
while(a%b){
c=a%b;
a=b;
b=c;
}
return b;
}
int main(){
//freopen("chess.in","r",stdin);
//freopen("chess.out","w",stdout);
freopen("d.in","r",stdin);
freopen("d.out","w",stdout);
scanf("%d",&t);
fo(i,1,t){
scanf("%lld%lld%lld",&n,&a,&b);
LL gc=gcd(a,b);
if(n/gc%2)printf("lidian
");
else printf("wfl
");
}
return 0;
}