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

int main()
{
    int T;cin>>T;
    int T1=T;
    bool tacno[T];
    while(T>0){
        int N; cin>>N;
        unsigned long long int M; cin>>M;
        int K; cin>>K;

        int sum1=0;
        int br=1;
        for(int i=1; i<=N/K; i++){
            sum1+=i;
            br++;
            
        }
        
        int sum2=0;
        if(N % K !=0){
            sum2 = (N%K) * br;
        }
        int sum= (sum1* K)+ sum2;
        if(sum<=M){
            tacno[T]= true;
        }else{
            tacno[T]= false;
        }
        T--;
    }
    for(int i =T1; i>0; i--){
        cout<<(tacno[i] ? "Tak" : "Nie")<<endl;
    }
}