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

int main(int argc, char** argv) {
	long long n, m, k, t;
	cin >> t;
	for(int i = 0; i<t; i++)
	{
		cin >> n >> m >> k;
		long long a = n/k;
		long long o = n%k;
		long long 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;
}