#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	int t,i;
	string s1 = "Tak",s0 = "Nie";
	bool tacno[10];
	cin >> t;
	for (i = 0; i < t; i++)
	{
		long long int k, m, n;
		long long int j = 1;

		cin >> n >> m >> k;

		long long int ucenik_po_grupi = n / k;
		long long int ostatak_ucenika = n % k;
		long long int p = m / k; //banana_po_grupi

		long long int max_banana = (-1 + sqrt(1 + 8 * p)) / 2;

		long long int ostatak_banana = m - k * max_banana * (max_banana + 1) / 2;

		if (ucenik_po_grupi > max_banana)
		{
			tacno[i] = false;
			continue;
		}
		else if (ucenik_po_grupi < max_banana)
		{
			tacno[i] = true;
			continue;
		}
		else
		{
			if (ostatak_banana >= ostatak_ucenika * (max_banana + 1))
				tacno[i] = true;
			else tacno[i] = false;
		}
	}

	for (i = 0; i < t; i++)
	{
		if (tacno[i])
			cout << s1 << endl;
		else cout << s0 << endl;
	}
	return 0;
}