#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 o = n%k;
		int s = (a+1)*a*(k-o)/2 + (a+1)*(a+2)*o/2;
		if(s<=m) cout << "Tak" << endl;
		else cout << "Nie" << endl;
	}
	return 0;
}