#include <iostream>

using namespace std;

int main()
{
    int t;
    cin >> t;
    long long int n, m, k;
    long long int n1 = 0, m1 = 0, n2 = 0, m2 = 0;
    for(int i = 0; i < t; i++){
        cin >> n >> m >> k;

        if(n%k == 0){
            n1  = n/k;
            m1 = m/k;

            if(n1*(n1+1) <= 2*m1)
                cout << "Tak" << endl;
            else cout << "Nie" << endl;
        }

        else if(n > 2){
            n1 = n%(k-1);
            n2 = n/(k-1);
            m1 = n1*(n1+1)/2;
            m2 = m-m1;

            if(n2*(n2+1) <= 2*m2)
                cout << "Tak" << endl;
            else cout << "Nie" << endl;
        }
    }
    return 0;
}