#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define ios ios_base::sync_with_stdio(false); cin.tie(0)
using namespace std;

int main()
{
    ios;
    long long t;
    cin>>t;
    long long x =t;
    bool r[t];
    for(int j =0;j<t;j++){
        long long N,M,K;
        cin>>N>>M>>K;
        long long a,b;
        a=N/K;
        b=N%K;
        long long c = (a*(a+1))/2;
        M-=c;
        if(M<0){r[j]=false;}
        else {
            c=(a+1)*b;
            M-=c;
            if(M<0){r[j]=false;}
            else r[j]=true;
        }
    }
    for(int i =0;i<t;i++){
        if(r[i]==true)cout<<"Tak"<<endl;
        else cout<<"Nie"<<endl;
    }
    return 0;
}