#include <iostream>

using namespace std;

int main()
{
    int t, n, m, k, y, z;
    cin >> t;
    bool r[t];

    for(int u = 0; u < t; u++)
    {
        cin >> n >> m >> k;
        y = n/k;
        z = (y*(y+1)/2) + ((n%k)*(y+1));
        if(m >= z)
            r[u] = true;
        else
            r[u] = false;
    }
    for(int i = 0; i < t; i++)
    {
        if(r[i])
            cout << "Tak" << endl;
        else
            cout << "Nie" << endl;
    }

    return 0;
}