#include <iostream>
#include <vector>
#include<map>


#include<tuple>

using namespace std;
#define ll long long




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

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