#include <iostream>

using namespace std;

int f(int x){
	int s = 0;
	for (int i = 1; i <= x; i++) s += i;
	return s;
}

int main(){
	int N, M, K, T, ost, del, S;
	cin >> T;
	string ans[T];
	for(int i = 0; i < T; i++){
		cin >> N >> M >> K;
		ost = N % K;
		del = N / K;
		S = ost * f(del + 1) + (K - ost) * f(del);
		if (M < S) ans[i] = "Nie";
		else ans[i] = "Tak";
	}
	for (int i = 0; i < T; i++){
		cout << ans[i] << endl;
	}
}