#include <iostream>

using namespace std;

int main()
{   long long int t,n,m,k;
    cin>>t;
    while(t--)
    {
        cin>>n>>m>>k;
        if(m>=(n%k)*(n/k+1)*(n/k+2)/2+(k-(n%k))*(n/k)*(n/k+1)/2)
            cout << "Tak" << endl;
        else
            cout << "Nie" << endl;
    }
    return 0;
}