#include<stdio.h>
#define MAXT  10
int main()
{
	int T, rem;
	long long M[MAXT], N[MAXT], K[MAXT];
	scanf("%d", &T);
	for (int i = 0; i < T; i++)
		scanf("%lli%lli%lli", &N[i], &M[i], &K[i]);
	for (int i = 0; i < T; i++)
	{
		rem = N[i] % K[i];
		if (rem != 0)
		{
			N[i] += rem;
			M[i] += (N[i] / K[i]) * (K[i] - rem);
		}
		if (M[i] >= ((N[i] / K[i]) * (N[i] / K[i] + 1)) / 2 * K[i])
			printf("Tak\n");
		else printf("Nie\n");	
	}
}