#include <bits/stdc++.h>
using namespace std;


int main(int argc, char** argv) {
	long long M,N,K,T;
	vector<string> v1;
	cin>>T;
	while (T--)
	{
		cin>>N>>M>>K;
		long long p=N/K;
		M-=K-1;
		N-=K-1;
	for (long long j=0;j<N;j++)	M-=j+1;
		if (M>=0) v1.push_back("Tak");
		else v1.push_back("Nie");
	}
	for (long long i=0;i<v1.size();i++) cout<<v1[i]<<endl;

	return 0;
}