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