#include <bits/stdc++.h>

int main()
{
    int t;
    scanf("%d", &t);

    bool results[20];

    for(int i = 0; i < t; i++)
    {
        long long n, m, k;
        scanf("%d %d %d", &n, &m, &k);

        long long minpergroup = n / k;
        long long total = 0;

        bool finished = false;
        for(int j = 1; j <= minpergroup; j++)
        {
            total += j;

            if(m / k < total)
            {
                results[i] = false;
                finished = true;
                break;
            }
        }
        if(finished) continue;

        total *= k;

        if(n % k > (m - total) / (minpergroup + 1))
        {
            results[i] = false;
            continue;
        }

        results[i] = true;
    }

    for(int i = 0; i<t; i++)
    {
        if(results[i] == true)
            printf("Tak\n");
        else
            printf("Nie\n");
    }

    return 0;
}