#include <bits/stdc++.h>

using namespace std;

int main()
{
    short t;
    cin >> t;
    short j, niz[t];
    unsigned long n[t], k[t];
    unsigned long long m[t], zbir;

    for (j = 0; j < t; j++)
    {
        cin >> n[j] >> m[j] >> k[j];
        zbir = 0;

        zbir = (n[j] % k[j])*(n[j]/k[j] + 1)*(n[j]/k[j] + 2) / 2  + (k[j] - n[j]%k[j])*(n[j] / k[j])*(n[j]/k[j] + 1) / 2;

        if (zbir > m[j])
            niz[j] = 0;
        else
            niz[j] = 1;

    }
    short q;
    for (q = 0; q < t; q++)
    {
        if (niz[q] == 1)
            cout << "Tak" << endl;
        else
            cout << "Nie" << endl;
    }
}