// I may fail a thousand times
// But there is no giving up
// IOI - here I come
#include <iostream>
#define int long long
using namespace std;
signed main(){
  ios_base::sync_with_stdio(0);cin.tie(0);
	int t;cin>>t;
	for(;t;t--){
		int n,m,k;cin>>n>>m>>k;
		int p=n/k;
		m-=p*(p+1)/2*(k-1);
		n-=p*(k-1);
		m-=n*(n+1)/2;
		if(m<0){
			cout<<"Nie\n";
		}else{
			cout<<"Tak\n";
		}
	}
	return 0;
}