#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0)
//#define L(x) (sizeof(x) / sizeof(*x))
#define ff(i,a,b) for(int (i) = (a); (i)<(b);(i)++)

long int typedef li;
long long int typedef lli;

using namespace std;
using namespace __gnu_pbds;

lli pb(lli n){
    lli s = 0;
    for(lli i = 0; i<n;i++){
        s+= i;
    }
    return s;
}
int main()
{
    int t,n,k;
    lli m;
    cin>> t;
    string iz[t];
    ff(i,0,t){
        cin>>n>>m>>k;
        int upg = n/k;
        int ostatak = n%k;
        lli spb = 0;
        if(ostatak == 0){
            spb = pb(bg)*k;
        }else{

                spb += ostatak * pb(upg+1);
                spb+= (k-ostatak) * pb(upg);
        }
        if(spb>m){
            iz[i] = "Nie";
        }else{
            iz[i] = "Tak";
        }
    }
    ff(i,0,t){
        cout>>iz[i];
    }
    return 0;
}