#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll N,K,M,T,pot;
int main(){
   cin>>T;
   while(T--){
      cin>>N>>M>>K;
      pot=((N/K)*(N/K+1)/2)*K;
      pot+=(N%K)*(N/K+1);
      if(pot<=M)
         cout<<"Tak"<<endl;
      else
         cout<<"Nie"<<endl;
   }
   return 0;
}