#include <iostream>

using namespace std;

int main()
{
	int m, n, k, treba,t;

	cin >> t;
	for (int i = 0; i < t; i++)
	{
		cin >> n >> m >> k;
		if (k == 1)
		{
			treba = n * (n + 1) / 2;
			if (treba <= m)
				cout << "Tak" << endl;
			else
				cout << "Nie" << endl;
		}
		else
		{
			if (n == 3)
			{
				if (k == 2)
				{
					if (m >= 4)
						cout << "Tak" << endl;
					else
						cout << "Nie" << endl;
				}
				else
				{
					if (k == 3)
					{
						if (m >= 3)
							cout << "Tak" << endl;
						else
							cout << "Nie" << endl;
					}
				}
			}
			else cout << "Tak" << endl;
		}
	}

	return 0;
}