#include <bits/stdc++.h>

using namespace std;
int T,N,M,K;
int zbir;
int main(){
   cin>>T;
   for (int i=1;i<=T;i++){
      cin>>N>>M>>K;
      zbir=0;
      if (N>M) cout<<"Nie"<<endl;

      //za 10 poena
      else if (N==3 and K!=1){
              if (M>N) cout<<"Tak"<<endl;
              else cout<<"Nie"<<endl;
           }

      //za 10 poena
      else if (K==1){
              for (int j=1;j<=N;j++){
                 zbir+=j;
              }
              if (M>=zbir) cout<<"Tak"<<endl;
              else cout<<"Nie"<<endl;
           }

      //za 20 poena
      else if (N<=10 and M<=100 and K!=1 and N!=3){
              if (K==2) cout<<"Tak"<<endl;
              //else if (N==3)
           }

      //za 60 poena

   }
   return 0;
}