#include <iostream>

using namespace std;

int main()
{
    long long n, m, k, t, f;
    cin >> t;
    for(long long i = 0; i < t; i++)
    {
        cin >> n >> m >> k;
        f = n/k;
        if(m < ((f*(f+1))/2)*k + (f+1)*(n%k)) cout << "Nie" << endl;
        else cout << "Tak" << endl;
    }
    return 0;
}