#include <iostream>

using namespace std;

void solve(){
long long int n,m,k,zk,nsak,grupe;
    cin >> n >> m >> k;
    nsak = n/k;
    zk = n%k;
    if(zk != 0){
    grupe = nsak * (nsak+1) * (k-1) / 2;
    grupe += zk * (zk+1);
    }else{
    grupe = nsak * (nsak+1) * (k) / 2;
    }
    if(grupe >= m){
        cout << "Nie" << endl;
    }else{
        cout << "Tak" << endl;
    }
    }

int main()
{
    int t;
    cin >> t;
    while(t){
        solve();
        t--;
    }

    return 0;
}