#include<iostream>

using namespace std;

void FICA()
{
   int t;

   cin>>t;

  // bool niz[t];

   int n,m,k;

   while(t--){

    cin>>n>>m>>k;

        int ostatak = n % k;
        int br = n / k;

        if((((br*(br+1))/2) * k + br * ostatak) > m){
            cout<<"Nie"<<endl;
            //niz[i] = true;
        }else{
            cout<<"Tak"<<endl;
            //niz[i] = false;
        }


   }

   /*for(int i:niz){
    if(i) cout<<"Nie"<<endl;
    else cout<<"Tak"<<endl;
   }*/

}

int main(void)
{
    FICA();
    return 0;
}