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

int t,n,m,k,b;

int main(){

    cin >> t;

    for(int i=1;i<=t;i++){
        cin >> n >> m >> k;
        if(k>n){
            cout << "nie" << endl;
        }
        else if(n%k==0){
            for(int j=1;j<=n/k;j++){
                b=b+j;
            }
            if(b*k<=m){
                cout << "tak" << endl;
            }
            else if(b*k>m){
                cout << "nie" << endl;
            }
        }
        else if(n%k>0){
            for(int j=1;j<=(n/k)+1;j++){
                b=b+j;
            }
            if(b*k<=m){
                cout << "tak" << endl;
            }
            else if(b*k>m){
                cout << "nie" << endl;
            }
        }
    }
    
return 0;
}