#include <bits/stdc++.h>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	
	int t; cin >> t;
	
	while(t--)
	{
		long long n, m, k; cin >> n >> m >> k;
		
		long long d = n / k;
		
		if((k * d * (d + 1)) / 2 + (n - k * d) * (d + 1) <= m) cout << "Tak\n";
		else cout << "Nie\n";
	}
	
	return 0;
}