#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*p*(p+1)/2+k*(p+1);
    if(minB<=M)cout<<"Tak"<<endl;
    else cout<<"Nie"<<endl;
  }
  return 0;
}