#include <bits/stdc++.h>
using namespace std;

bool MozeSePodeliti(int x, int n) {
	if (x >= (n + 1) * n / 2) {
		return true;
	}
	return false;
}

int main(int argc, char const *argv[])
{
	int T;
	cin >> T;
	while (T--) {
		int n, m, k;
		cin >> n >> m >> k;
		if (MozeSePodeliti(m / k, n / k) && MozeSePodeliti(m / k + m % k, n / k + n % k)) {
			cout << "Tak" << endl;
		}
		else {
			cout << "Nie" << endl;
		}
	}
	return 0;
}