#include <iostream>
#include <string>
using namespace std;
int main() {
	unsigned short int i,T;
	int N;
	unsigned long long int M,K,Mak;
	cin>>T;	
	string S[T];
	for(i=0;i<T;i++){
		cin>>N;
		cin>>M;
		cin>>K;	
		Mak=N+K-N%K;
		if((((Mak/K)*((Mak/K)+1)/2)*K)-((K-N%K)*(Mak/K))<M)
			S[i]="Tak";
		else
			S[i]="Nie";
	}
	for(i=0;i<T;i++){
		cout<<S[i]<<endl;
	}
	return 0;
}