#include <iostream>
#include <vector>
using namespace std;
int main(){

	int i,t,b,c,d,j;
	
	cin>>t;

	vector <int> n(t);
	vector <int> m(t);
	vector <int> k(t);
	vector <int> r(t);
	for (i=0;i<t;i++){
		cin>>n[i];
		cin>>m[i];
		cin>>k[i];
		b=(n[i]/k[i]);
		c=b;
		d=c;
		for(j=0;j<b;j++){
			d=d+(c-1);
			c--;
		}
		if(m[i]/2<d) r[i]=1;
		else r[i]=2;
	}
	for (i=0;i<t;i++){
		if (r[i]==1)cout<<"Nie"<<endl;
		if (r[i]==2)cout<<"Tak"<<endl;
	}

}