#include <iostream>

using namespace std;

int main()
{
    // Deklaracija
    int t, n, k;
    unsigned long long int m, z;
    cin >> t;
    string r[t];

    if (k == 1)
    {
        for (int i = 0; i < t; i++)
        {
            cin >> n >> m >> k;
            z = n*(n+1)/2;
            if (m >= z)
            {
                r[i] = "Tak";
            }
            else
            {
                r[i] = "Nie";
            }
        }

        for (int i = 0; i < t; i++)
        {
            cout << r[i] << endl;
        }
    }
    else
    {
        for (int i = 0; i < t; i++)
        {
            cin >> n >> m >> k;

            n /= k;
            z = n*(n+1)/2;
            m /= k;
            if (m >= z)
            {
                r[i] = "Tak";
            }
            else
            {
                r[i] = "Nie";
            }
        }

        for (int i = 0; i < t; i++)
        {
            cout << r[i] << endl;
        }
    }


    return 0;
}