#include <iostream>
#include <stdio.h>

using namespace std;

int zbirDoN(int n)
{
	return (n * (n + 1)) / 2;
}

int main() 
{
	int t;
	cin >> t;
	int* n = new int[t];
	int* m = new int[t];
	int* k = new int[t];
	bool* check = new bool[t];

	int minB;

	for (int i = 0; i < t; i++)
	{
		cin >> n[i] >> m[i] >> k[i];

		minB = (k[i] - (n[i] % k[i])) * zbirDoN(n[i] / k[i]) + (n[i] % k[i]) * zbirDoN(n[i] / k[i] + 1);

		if (m[i] < minB)
		{
			check[i] = false;
			continue;
		}

		check[i] = true;
	}
	for (int i = 0; i < t; i++)
	{
		if (check[i])
		{
			cout << "Tak\n";
		}
		else
		{
			cout << "Nie\n";
		}
	}
}