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


int main(int argc, char** argv) {
	int t;
	cin>>t;
	bool o[t];
	for(int i=0;i<t;i++){
		unsigned long long n,k,m;
		
		cin>>n>>m>>k;
		
		unsigned long long a[k];
		if(m<n or n<k){
			o[i]=false;
			break;
		}
		for(unsigned long long j=0;j<k;j++){
			a[j]=n/k;
		}
		unsigned long long p=n%k;
		for(unsigned long long r=0;r<p;r++){
			a[r]++;
		}
		unsigned long long s=0;
		for(unsigned long long y=0;y<k;y++){
			unsigned long long u=a[y];
			s+=(u*(u+1))/2;
		}
		if(s<=m)o[i]=true;
		else o[i]=false;
		
		
	}
	for(unsigned long long i=0;i<t;i++){
		if(o[i])cout<<"Tak"<<endl;
		else cout<<"Nie"<<endl;
	}
	return 0;
}