#include <bits/stdc++.h>
using namespace std;

long long n, m, k, t, o, res, s;
int main(){
 scanf("%d", &t);
 while(t--){
   scanf("%d%d%d", &n, &m, &k);
   o = n%k;
   s = n/k;
   res = s*(s*(s*+1)/2) + o*((s+1)*(s+2)/2);
    if(m>=res) cout<<"Tak"<<endl;
    else cout<<"Nie"<<endl;

 }

}