using namespace std;
long long t,n,m,k,delilac,ostatak,zbir;


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin>>t;
    while(t--)
    {
        cin>>n>>m>>k;
        delilac=n/k;
        ostatak=n%k;
        zbir = ostatak*((delilac+1)*(delilac+2))/2 + (k-ostatak)*(delilac*(delilac+1))/2;

        if(m>=zbir)
            cout<<"Tak"<<"\n";
        else
            cout<<"Nie"<<"\n";
    }
}