#include <iostream>

using namespace std;


int main()
{
	int t;
	cin >> t;
	
	int n, m, k;
	
	int zbir = 0;
	
	int pom;
	
	for (int i = 0; i < t; i++)
	{
	    cin >> n >> m >> k;
	    
	    if (k==1) {
	        
	        pom = n*(n+1)/2;
	        
	       if (m >= pom) cout << "Tak" << endl;
	      else cout << "Nie" << endl;
	        
	    }
	    
	 else 
	 {
	      
	    if (n==k) cout << "Tak" << endl;
	    
     else {  pom = n%k;
       
       int pom1 = n/k;
	        
	   zbir = (pom1*(pom1+1)/2) * k + pom * k + 1;
	     
	     if (zbir > m) cout << "Nie" << endl;
	     else cout << "Tak" << endl;
	     
     }
	 }
	}
	
	
	return 0;
	
}