#include <bits\stdc++.h>

using namespace std;

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