#include <iostream>

#define IMA_TESTOVE 1

typedef long long ll;

using namespace std;

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

int main()
{
	int t = 1;
	if (IMA_TESTOVE)cin >> t;
	for (int i = 0; i < t; i++)solve();
}