#include <stdio.h>
#include <string.h>

int main()
{
    char t[11][4];
    unsigned long long int n, m, k;
    int i, brTestova, ukupno = 0;

    scanf("%d", &brTestova);
    for (i = 0; i < brTestova; i++)
    {
        scanf("%llu %llu %llu", &n, &m, &k);
        if (m < n)
            strcpy(t[i], "Nie");
        else
        {
            ukupno = (k - 1) * ((n / k * (n / k + 1)) / 2) + (n / k + n % k) * (n / k + n % k + 1) / 2;
            if (ukupno <= m)
                strcpy(t[i], "Tak");
            else
                strcpy(t[i], "Nie");
        }
    }
    for (i = 0; i < brTestova; i++)
        printf("%s%s", t[i], i < brTestova - 1 ? "\n" : "");

    return 0;
}