#include <iostream>

using namespace std;

int main()
{
    int t, x, z, y, br, br1, br2, z1, z2;
    cin >> t;
    int n[t], m[t], k[t];
    for(int  i = 0; i < t; i++){
        cin >> n[i] >> m[i] >> k[i];
        if(k[i] > n[i])
            cout << "Nie" << endl;
        else{
                z1 = n[i]/k[i];
                z2 = n[i]/k[i] + 1;
                br1 = (z1 * (z1 + 1))/2;
                br2 = (z2 * (z2 + 1))/2;
                x = k[i] - 1;
                y = n[i]%k[i];
                x = k[i] - y;
                if((x*br1 + y*br2) > m[i])
                    cout << "Nie" << endl;
                else
                    cout << "Tak" << endl;

            }

        }
    return 0;
}