#include <stdio.h>
#include <stdlib.h>
int main()
{
    int i, n,rem, T;
    int N;
    long long int M,minBananica;
    int K;
    char solution[10];
    scanf("%d", &T);
    for(i=0;i<T;i++){
        scanf("%d %lld %d", &N,&M,&K);

        if(N>=K){
            n=N/K;
            rem=N%K;
            minBananica=(long long) K*(n*(n+1)/2)+rem*(n+1);
            if(M>=minBananica) solution[i]='T';
            else solution[i]='N';
        }
        else{
            solution[i]='N';
        }
    }
    for(int i=0;i<T;i++){
        if(solution[i]=='N') printf("Nie\n");
        else printf("Tak\n");
    }
    return 0;
}