#include<bits/stdc++.h>

using namespace std;

int main() {
	int t;
	cin >> t;
	int n;
	long long m;
	int k;

	for(int i=0;i<t;i++) {
		cin >> n;
		cin >> m;
		cin >> k;
		if((k-1)*n/k*(n/k+1)/2+(n-(k-1)*n/k)*(n-(k-1)*n/k+1)/2<=m) cout << "Tak\n";
		else cout << "Nie\n";
	}
}