#include <bits/stdc++.h>

using namespace std;

void bananica(long long int n, long long int m, long long int k){
	long long int rez, n1, n2;
	n1=n/k;
	n2=n%k + n1;
	rez= (k-1)*n1*(n1+1)/2+ n2*(n2+1)/2;
	
	if(rez>m) cout<<"Nie\n";
	else cout<<"Tak\n";
} 

int main(){
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL) ; cout.tie(NULL) ;
    
    int t;
    cin>>t;
    
    long long int n, m, k;
    while(t--){
    	cin>>n>>m>>k;
    	bananica(n, m, k);
	}
	
	return 0;
}