#include <iostream>
using namespace std;
int main ()
{   int t,n,m,k,s=0,i;
    cin>>t;
    string a[t];
    for (i=0;i<t;i++){
        cin>>n>>m>>k;
        if(k>n)
            a[i]="Nie";
        else{for (int j=1;j<=n/k;j++){
            s+=j*k;
        s+=n%k*n/k;
        if(s>m)
            a[i]="Nie";
        else
            a[i]="Tak";}}
    }
    for (i=0;i<t;i++)
        cout<<a[i]<<endl;
        
    return 0;
}