#include<stdio.h>
#include<stdlib.h>
#include<string.h>
    int main()
{
    int  t, r, i, j, niz[10], z;
    long int n, m, k;
    scanf("%d", &t);
    r = 0;
    for (i = 0; i < t; i++){
        scanf("%ld%ld%ld", &n, &m, &k);
        for (j = 0; j <= (n / k); j++)
        {
            r = r + j;
        }
        if ((r * k) + n % k * (n / k + 1) <= m){
            niz[i] = 1;
        }
        else{
            niz[i] = 0;
        }
    r = 0;
    }
    for(z = 0; z <= t - 1; z++){
        if (niz[z] == 1)
        printf("Tak \n");
        else if (niz[z] == 0){
            printf("Nie \n");
        }
    }
    
}