#include<bits/stdc++.h>
using namespace std;
long long t,n,m,k,br,br1,suma,niz[100000005],p,b,q;
int main(){
    cin>>t;
    for(long long i=1;i<=t;i++){
        suma=0;
        p=1;
        b=1;
        cin>>n>>m>>k;
        br1=n%k;
        br=n/k;
        if(n<k) cout<<"Nie"<<endl;
        else{
            for(long long j=1;j<=k;j++){
                b=1;
            while(br>0){
                niz[p]=b;
                suma+=niz[p];
                p+=1;
                b+=1;
                br--;
            }
        }
        if(br1==0){
            q=m-suma;
            if(q<0) cout<<"Nie"<<endl;
            else cout<<"Tak"<<endl;
        }
        else{
            while(br1>0){
                b=1;
                if(br1=1){
                        niz[p]=m-suma;
                        q=m-suma;
                }
                else{
                niz[p]=b;
                suma+=niz[p];
                p+=1;
                b+=1;
                }
                br1--;
            }
            if(q<=0) cout<<"Nie"<<endl;
            else cout<<"Tak"<<endl;
        }
        }
    }
return 0;
}