#include<stdio.h>
main()
{
	int T;
	scanf("%d",&T);
	int N[T],M[T],K[T],i;
	for(i=0;i<T;i++)
		scanf("%d%d%d",&N[i],&M[i],&K[i]);
	for(i=0;i<T;i++)
	{
		if(N[i]>=M[i])
			if(i==T-1)
				printf("Nie");
			else
				printf("Nie\n");
		else
		{
			int k[K[i]][200000];
			if(N[i]>=K[i])
			{
				if(N[i]==K[i] && N[i]<=M[i])
					if(i==T-1)
						printf("Tak");
					else
						printf("Tak\n");
				else
				{
					int nk,br,j,Mi,s=0;
					nk=(N[i]/K[i])+(N[i]%K[i]);
					for(br=0;br<K[i];br++)	
						for(j=0,Mi=1;j<nk;j++,Mi++)
						{
							if(j>=nk-1-(N[i]%K[i]))
							{
								k[br][j]=0;
							}
							else
							{
								k[br][j]=Mi;
								s+=Mi;
							}				
						}
					if(s<=M[i])	
						if(i==T-1)
							printf("Tak");
						else
							printf("Tak\n");
					else
						if(i==T-1)
							printf("Nie");
						else
							printf("Nie\n");
				}
			}
			else
				if(i==T-1)
					printf("Nie");
				else
					printf("Nie\n");
		}	
	}		
}