#include <stdio.h>

int main()
{
    long long n, m, k, p, d, i = 0;
    int t;
    scanf("%d", &t);
    short niz[t];

    while(t)
    {
        scanf("%lld %lld %lld", &n, &m, &k);
        d = n/k;
        p = (k - (n%k))*(d+1)*d/2 + (n%k)*(d+1)*(d+2)/2;
        if(p <= m)
            niz[i] = 1;
        else
            niz[i] = 0;
        i++;
        t--;
    }
    for(int j = 0; j < i;j++)
    {
        if(niz[j] == 1)
            printf("Tak\n");
        else
            printf("Nie\n");
    }
}