#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    int t,n,m,k,i,l,b,x;
    cin >> t;
    bool bul[t];
    for(i=0; i<t; i++)
    {
        b = 0;
        cin >> n >> m >> k;
        for(l=0; l<k-1; l++)
        {
            x = n/k;
            b += x*(x+1)/2;
        }
        x = n/k+(n%k);
        b += x*(x+1)/2;
        if(m >= b) bul[i] = true;
        else bul[i] = false;

    }
    for(i=0; i<t-1; i++)
    {
        if(bul[i]) cout << "Tak" << "\n";
        else cout << "Nie" << "\n";
    }
    if(bul[i]) cout << "Tak";
    else cout << "Nie";
    return 0;
}