#include <iostream>
#include <vector>

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

int main()
{
	int num_t;

	std::cin >> num_t;

	for(int i = 0; i < num_t; i++)
	{
		int num_s, num_b, num_g;

		std::cin >> num_s >> num_b >> num_g;

		std::vector<int> groups(num_g);

		int selector = 0;
		for(int i = 0; i < num_s; i++)
		{
			groups[selector]++;

			selector++;
			if(selector >= num_g)
				selector = 0;
		}

		int req_b = 0;
		for(int i = 0; i < num_g; i++)
		{
			if(i == num_g - 1)
				req_b += sum_first_n(groups[i] - 1);

			req_b += sum_first_n(groups[i]);
		}

		if(req_b + groups[num_g - 1] > num_b)
			std::cout << "Nie\n";
		else
			std::cout << "Tak\n";
	}
	
	return 0;

}