#include<iostream>
#include<vector>
using namespace std;
int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	unsigned short T;
	unsigned int N, K;
	unsigned long long int M;
	cin>>T;
	
	for(int i=0; i<T; i++) {
		cin>>N>>M>>K;
		vector<int>v(K);
	unsigned int x=K; unsigned long long int o=M; bool a=true;
		for(int j=x-1; j>=0; j--) {
			v[j]=N/K;
			N-=N/K;
			K--;
				unsigned long long int s=v[j]%2==0 ? (v[j]/2)*(v[j]+1) : ((v[j]+1)/2)*v[j];
			if(s>o) {
				cout<<"Nie\n";
				a=false;
				break;
			}
			else o-=s;
		}
		if(a) cout<<"Tak\n";
	
	}
	

return 0;
}