#include <bits/stdc++.h>
using namespace std;
long long t,n,m,k,res;
int main () {
  cin>>t;
  while (t--) {
    cin>>n>>m>>k;
    res=k*n/k*(n/k+1)/2+(n%k)*(n/k+1);
    if (n<k) {
      cout<<"Nie"<<endl;
      continue;
    }
    if (res<=m) {
      cout<<"Tak"<<endl;
    }
    else cout<<"Nie"<<endl;
  }
return 0;
}