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