#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
cin>>t;
while(t--)
{
long long n,m,k;
cin>>n>>m>>k;
long long z=0;
long long broj1=((k-1)*(n/k));
long long broj2=n-broj1;
z=z+(broj1*(n/k+1)/2);
z=z+(broj2*(broj2+1)/2);
if(z<=m)
cout<<"Tak"<<endl;
else
cout<<"Nie"<<endl;
}
return 0;
}