#include <iostream>
//#include <fstream>
//#include <iomanip>
//#include <cmath>
//#include <algorithm>
//#include <string>
//#include <vector>
//#include <utility>
//#include <map>
//#include <ctime>
//#include <cctype>
//#include <cstdlib>
//#include <limits>
//#include <numeric>
//#include <mycpp.h>

using namespace std;

long long Suma(long long a)
{
	return (a % 2 == 0) ? ((a / 2) * (a + 1)) : (((a + 1) / 2) * a);
}

bool Slucaj()
{
	long long n, m, k;
	cin >> n >> m >> k;
	long long d = n / k;
	long long o = n % k;
	long long min = o * Suma(d + 1) + (k - o) * Suma(d);
//	cout << d << " " << o << " " << min << endl;
	return min <= m;
}

int main()
{
	std::ios_base::sync_with_stdio(false);
	int t;
	cin >> t;
	bool odg[t];
	for(int i = 0; i < t; i++)
		odg[i] = Slucaj();
	for(int i = 0; i < t; i++)
		cout << (odg[i] ? "Tak" : "Nie") << endl;
	
}