#include<bits/stdc++.h>
using namespace std;

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