#include <iostream>


using namespace std;
#define ll long long




int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;

	for (ll j = 0; j < n; j++)
	{
		ll ljudi, banan, grupe;
		ll zbir = 0;
		cin >> ljudi >> banan >> grupe;
		if (grupe > ljudi)
		{
			cout << "Nie" << "\n";
			continue;
		}
		ll ostatak = ljudi % grupe;
		ll nes = ljudi / grupe;
		for (ll i = 0; i < ostatak; i++)
		{
			zbir += (((nes + 1) * (2 + nes)) / 2);
		}
		for (ll i = 0; i < (grupe - ostatak); i++)
		{
			zbir += (((nes) * (1 + nes)) / 2);
		}
		if (zbir > banan)
		{
			cout << "Nie" << "\n";
			continue;
		}
		else
		{
			cout << "Tak" << "\n";

			continue;
		}
	}


}