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