#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
using namespace std;

int main()
{
	int t;
	cin >> t;
	while(t--)
	{
	    ll n,m,k;
	    cin >> n >> m >> k;

        if(m<n)
        {
            cout << "Nie" << endl;
        } else {
            ll maxPerGroup = ceil((double)n/(double)k);
            ll repeatMaxPerGroup = n%k;
            ll reqSum = repeatMaxPerGroup*((1+maxPerGroup)*maxPerGroup)/2;

            ll other = n/k;
            ll otherSum = (k-repeatMaxPerGroup)*((1+other)*other)/2;

            if((reqSum + otherSum) <= m)
            {
                cout << "Tak" << endl;
            } else {
                cout << "Nie" << endl;
            }
        }
	}
}