#include<bits/stdc++.h>

using namespace std;

long long t,n,m,k,a,b,v,g; /// a - 33    b - 34

int main()
{
    cin>>t;
    while(t--)
    {
        cin>>n>>m>>k;
        b=n%k;
//        a=k-b;
        g=n/k;
        v=(g*(g+1))/2;
//        cout<<v<<endl;
//        cout<<k*v+b*(g+1)<<endl;
        if(m>k*v+b*(g+1))
            cout<<"Tak"<<endl;
        else
            cout<<"Nie"<<endl;

    }
    return 0;
}