#include <bits/stdc++.h>

using namespace std;

int main()
{
    unsigned short t;
    unsigned k, n, tempN, tempN2;
    unsigned long long m, tempM, brojBananicaUGrupi;

    cin >> t;
    string res [t];
    for (short o = 0; o < t; o++) {
        res [o] = "Tak";
    }

    for (unsigned short i = 0; i < t; i++) {
        cin >> n >> m >> k;
        tempN = n / k;
        brojBananicaUGrupi = (tempN / 2) * (tempN - 1);
        tempM = m - brojBananicaUGrupi * k;
        tempN2 = tempN;
        if (tempM <= brojBananicaUGrupi) {
            res [i] = "Nie";
            continue;
        }
        

    }

    for (unsigned short i = 0; i < t; i++) {
        cout << res [i] << endl;
    }
}