#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define rep(i,n) for(int i=0;i<n;i++)
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;

void solve(){
	int n, m ,k;
	cin >> n >> m>>k;
	bool ok = true;
	ok &= ((m/k)*2>=(n/k)*(n/k+1));
	if(m%k < n%k)ok &= ((m/k)*2>=(n/k+2)*(n/k+1));
	if(m%k!=0)m++;
	if(n%k!=0)n++;
	ok &= ((m/k + 1)*2>=(n/k)*(n/k+1));
	ok? cout << "Tak\n" : cout << "Nie\n";
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t; cin >> t;
	while(t--)solve();
	return 0;
}