#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

ll arithmetic_sum_upto(ll n)
{
	return n * (n + 1) / 2;
}

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

	int test_cnt; cin >> test_cnt;
	while (test_cnt--)
	{
		ll student_cnt, sum, group_cnt;
		cin >> student_cnt >> sum >> group_cnt;
		ll min_per_group = student_cnt / group_cnt;
		ll rem = student_cnt % group_cnt;

		ll cnt_less_students = group_cnt - rem;
		ll cnt_more_students = rem;
		ll sum1 = cnt_less_students * arithmetic_sum_upto(min_per_group);
		ll sum2 = cnt_more_students * arithmetic_sum_upto(min_per_group+1);
		if (sum >= sum1+sum2)
		{
			cout << "Tak\n";
		}
		else
		{
			cout << "Nie\n";
		}
	}
	return 0;
}