#include <iostream>

using namespace std;

int main()
{

    int t;

    cin >> t;

    int n, k;

    long long int m;

    string res[t];

    long long int por;

    for(int i = 0; i < t; i++){

        cin >> n >> m >> k;

        int pom = n / k;

        n = n - (pom * k);

        m = m - (k * ( (pom * (pom + 1) ) / 2 ) );

        m = m - ( (pom + 1) * n);

        if(m >= 0) res[i] = "Tak";

        else res[i] = "Nie";

    }

    for(int j = 0; j < t; j++){

        cout << res[j] << endl;

    }

    return 0;
}