#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, char** argv) {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >>t;
	for(int z=0;z<t;z++)
	{
		unsigned long long int n,k;
		unsigned long long int m;
		cin >>n>>m>>k;
		unsigned long long int br=0;
		unsigned long long int h=n/k;
		br=((h+1)*h/2)*k+(h+1)*(n%k);
		if(br<=m)
		{
			cout <<"Tak\n";
		}
		else
		{
			cout <<"Nie\n";
		}
	}
	return 0;
}