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

bool solve(int n, long long m, int k){
	
	if(n < m){
	
	if(n >= k){
		
		if(n % k == 0){
			
			if(m % k == 0){
			
			int br = n / k;
			int brb = m / k;	
			
			long long sum = (br * (br + 1)) / 2;
			
			if(sum <= brb)return true;
			
			}	
		
		else{
			int br = n / k;
			int brb = (m / k) + (m % k);
			//int brc = m % k;
			
			long long sum = (br * (br + 1)) / 2;
		
			if(sum <= brb)return true;
		
			}
	
		}
		else{
			
			if(m % k == 0){
			
			int br = n / k + (n % k);
			//int br2 = (n / k) + (n % k);
			int brb = m / k;
				
				long long sum = (br * (br + 1)) / 2;
			//	long long sum2 = (br2 * (br2 +1)) / 2;
				
				if(sum <= brb)return true;
				
			}
			
		else{
				int br = n / k + (n % k);
			//int br2 = (n / k) + (n % k);
			int brb =(m / k) + (m % k);
			
				long long sum = (br * (br + 1)) / 2;
			//	long long sum2 = (br2 * (br2 +1)) / 2;
				
				if(sum <= brb)return true;
		
			}	
			
		}
		
	}
	
}
	return false;
}

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int t;
	
	cin >> t;
	
	int n[t],k[t];
	long long m[t];
	
	for(int i = 0; i < t; i++){
		
		cin >> n[i] >> m[i] >> k[i];
		
	}
	
	for(int i = 0; i < t; i++){
		
		if(solve(n[i],m[i],k[i]))cout<<"Tak"<<"\n";
		else cout << "Nie" << "\n";
		
	}
	
	return 0;
}