#include <bits/stdc++.h>

using namespace std;

int main()
{
    long long int t,n,m,k;
    vector <long long int> c;
    cin >> t;
    for(long long int i = 0; i < t; ++i)
    {
        cin >> n >> m >> k;
        if(n%k == 0)
        {
            if(m >= k*(n/k)*(n/k+1)/2)
            {
                c.push_back(1);
            }
            else
                c.push_back(2);
        }
        else
        {
            if(m >= k*(n/k)*(n/k+1)/2 + (n%k)*(n/k+1))
            {
                c.push_back(1);
            }
            else
                c.push_back(2);
        }
    }
    for(unsigned i = 0; i < c.size(); ++i)
    {
        if(c[i] == 1)
        {
            cout << "Tak" << endl;
        }
        else if(c[i] == 2)
        {
            cout << "Nie" << endl;
        }
    }
    return 0;
}