#include<bits/stdc++.h>
using namespace std;
long long n,k,t,m,n1,n2,s;
int main()
{
    cin >> t;
    for(int i=0;i<t;i++)
    {
        cin >> n >> m >> k;
        n1=n/k;
        n1++;
        n2=n%k;
        s=(n1*(n1+1)/2)*n2+(n1*(n1-1)/2)*(k-n2);
        if((s>m)||(s<0)) cout << "Nie"<<endl;
        else cout <<"Tak"<<endl;
    }
}