#include <iostream>
using namespace std;
int main()
{
    int T;
    cin >> T;
    int suma1[T];
    int suma2[T];
    int x[T];
    int N[T],M[T],K[T];
    for(int i =0;i<T;i++){
        cin >> N[i] >> M[i] >> K[i];
        x[i] = N[i]/K[i];
    }
    for(int i =0;i<T;i++){
        int y = N[i]-K[i]+1;
        if(N[i]%K[i]==0){
            suma1[i] =  (((x[i])*(x[i] + 1))/2)*K[i];
            suma2[i] = 0;
        }else if(N[i]%K[i]!=0){
            suma2[i] =  K[i]-1+((y)*(y+1))/2;
            suma1[i]=0;
        }

    }
    for(int i =0;i<T;i++){
        if(suma1[i]+suma2[i]<M[i]){
            cout << "Tak" << endl;
        }else{
            cout << "Nie" << endl;
        }
    }


    }