#include <iostream>

using namespace std;

int main()
{
    int t;
    int n[10];
    long m[10];
    int k[10];

    cin >> t;

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

    for (int i = 0; i < t; i++)
    {
        double a = n[i] / k[i];
        double b = n[i] % k[i];

        int rez = (a * (a + 1)) / 2 * (k[i] - b) + ((a + 1) * (a + 2)) / 2 * b;
        if (rez<=m[i])
        {
            cout << "Tak\n";
        }
        else
        {
            cout << "Nie\n";
        }
    }


}