#include <bits/stdc++.h>
using namespace std;
long long t,n,k,m,a[2005],r,r1,u;
void sastaviniz(){
    a[1]=1;
    for(int i=2;i<=2000;i++){
        a[i] = a[i-1]+i;
    }
}
int main() {
    cin >> t;
    sastaviniz();
    while(t--){
        cin >> n >> m >> k;
        r = n/k + n%k;
        r1 = n/k;
        u = a[r] + (k-1)*a[r1];
        if(n<k) cout << "Nie" <<endl;
        else if(m>=u) cout << "Tak" <<endl;
        else cout << "Nie" <<endl;
    }
return 0;
}