#include <iostream>

using namespace std;

int main(void)
{
    unsigned short int t;
    unsigned int n, k;
    unsigned long long int m;

    cin >> t;

    for(unsigned short int i=0; i<t; ++i)
    {
        cin >> n >> m >> k;
        unsigned long long int m_min = (k-1) * (((n/k) * (n/k + 1)) / 2) + ((n/k + n%k) * (n/k + n%k + 1) / 2) ;

        if(m_min <= m)
            cout << "Tak" << endl;
        else
            cout << "Nie" << endl;
    }

    return 0;
}