#include <bits/stdc++.h>

typedef long long ll;
using namespace std;

void solve()
{
	ll n, m, k;
	cin >> n >> m >> k;
	ll g = n / k;
	ll gM = n % k;
	ll minBan = (k-gM)*(g*(g+1)/2) + gM*((g+1)*(g+2)/2);
	if (minBan <= m)
	{
		cout << "Tak\n";
	}
	else
	{
		cout << "Nie\n";
	}
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t;
	cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}