#include <iostream>
using namespace std;

int main() {

	short T;
	int N, K;
	long M;

	long upg;
	int ostatak;
	int gr1;
	long zbir=0;
	cin >> T;

	for (int i = 0; i < T; i++) {

		cin >> N >> M >> K;
		upg = N / K; 
		ostatak = N % K; 
		gr1 = K - ostatak;

		for (long i = 0; i <= upg; i++) {
			zbir = zbir + i;
		}

		if (zbir <= M)
			cout << "Tak" << endl;
		else
			cout << "Nie" << endl;
	}
	return 0;
}