#include <iostream>
#include <cmath>
using namespace std;

int main(int argc, char** argv) {
	int n, m, k, t;
	cin >> t;
	for(int i = 0; i<t; i++)
	{
		cin >> n >> m >> k;
		int a = n/k;
		int b = a+n%k;
		int s = (a+1)*a*(k-1)/2 + b*(b+1)/2;
		if(s<=m) cout << "Tak" << endl;
		else cout << "Nie" << endl;
	}
	return 0;
}