#include <stdio.h>
#include <stdlib.h>
#include <string.h>
	

int rest(int num)
{
	return (num * (num + 1)) / 2;
}

int main() 	
{
	int testnum, s, g;
	scanf("%d",&testnum);

	int need[testnum];
	int k[testnum];
	for(int i = 0 ; i < testnum ; i++)
	{
		scanf("%d %d %d", &s, &k[i], &g);
		int groupsizes[g];
		memset( groupsizes, 0, g*sizeof(int) );		


		int limit = 0;
		for(int j = 0 ; j < s ; j++)
		{

			groupsizes[limit]++;
			
			limit++;
			if(limit >= g)
				limit = 0;
		}
		
		need[i] = 0;
		for(int l = 0 ; l < g ; l++)
		{
			if(need[i] == g - 1)
				need[i] += rest(groupsizes[l] - 1);

			need[i] += rest(groupsizes[l]);
		}

	}

		for(int i = 0 ; i < testnum ; i++)
			if(need[i] > k[i])
				printf("Nie\n");
			else
				printf("Tak\n");

	return 0;
}