#include <iostream>
using namespace std;

int main() {
    short int T;
    cin>>T;
    unsigned int N,K,suma;
    unsigned long long int M,br,ostatak;
    for(int i=0; i<T; i++){
        cin>>N>>M>>K;
        br=N/K;
        ostatak=N%K;
        suma=(N/br)*(br+1)*br/2+(ostatak+1)*ostatak/2;
        if(suma<=M)
            cout<<"Tak\n";
        else
            cout<<"Nie\n";
    }
}