#include <iostream>
using namespace std;
int main()
{
    int i=0, j=0;
    int t;
    cin >> t;
    long long n[t], m[t], k[t], nig[t];
    for(i=0;i<t;++i)
    {
        cin >> n[i] >> m[i] >> k[i];
        nig[i] = 0;
    }
    for(i=0;i<t;++i)
    {
        if(k[i]!=1)
        {
            n[i] = n[i] / k[i];
            m[i] = m[i] / k[i];
        }
            // prvih n
            for(j=0;j<=n[i];++j)
            {
                nig[i] = nig[i] + j;
            }
            if((n[i] > m[i]) || (n[i] < k[i]))
            {
                cout << "Nie" << endl;
            }
            else{
                if(m[i] >= nig[i])
                {
                    cout << "Tak" << endl;
                }
                else
                    cout << "Nie" << endl;
            }
        }

     return 0;
}