#include<bits/stdc++.h>

using namespace std;

int main(){
    int t;
    cin>>t;
    for(int i = 0;i<t;i++){
        int64_t n, m, k;
        cin>>n>>m>>k;
        int64_t t = n/k;
        int64_t u = n%k;
        int64_t r = ((t*(t+1)*(k-u))+((t+1)*(t+2)*(u)))/2;
        if(r>m){
            cout<<"Nie"<<endl;
        } else{
            cout<<"Tak"<<endl;
        }
    }




    return 0;
}