#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cerr.tie(NULL);
    cout.tie(NULL);

    int t, i;
    cin >> t;
    int n[t];
    int m[t];
    int k[t];
    for(i=0;i<t;i++)
        cin >> n[i] >> m[i] >> k[i];
    for(i=0;i<t;i++)
    {
        if(n[i]%k[i]==0 && m[i]<k[i]*(n[i]/k[i])*(n[i]/k[i]+1)/2)
            cout << "Nie" << endl;
        else if(m[i]<(k[i]*((n[i]-n[i]%k[i])/k[i])*((n[i]-n[i]%k[i])/k[i]+1)/2) + (k[i]*(n[i]%k[i]/k[i])*(n[i]%k[i]/k[i]+1)))
            cout << "Nie" << endl;
        else if(n[i]<k[i])
            cout << "Nie" << endl;
        else
            cout << "Tak" << endl;
    }
    return 0;
}