#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
	long long t, n, m, k, n1, m1 ;
	bool b = true;
	cin>>t;
	for(int qwerty = 0; qwerty<t; qwerty++){
	cin>>n>>m>>k;
	while(k>=1 && b){
		n1 = n/k;
		n-=n1;
		if(n1 == 1) m-=1;	
		else {
			m1 = m/k;
			for(long long i=1; i<=n1 ; i++){
			m1-= i;
			if(m1 < 0) b = false;}}
		k--;}
	if(b == true) cout<<"Tak"<<endl;
	else cout<<"Nie"<<endl;
	b = true;}
	return 0;}