#include<stdio.h>
#include<math.h>
main()
{
	int T;
	scanf("%d",&T);
	if(T<=10 && T>=1)
	{
		int N[T],M[T],K[T],i;
		for(i=0;i<T;i++)
		{
			scanf("%d%d%d",&N[i],&M[i],&K[i]);
			if(N[i]<1 || N[i]>pow(10,9) || K[i]<1 || K[i]>N[i] || M[i]<1 || M[i]>pow(10,17))
				break;	
		}	
		for(i=0;i<T;i++)
		{
			if(N[i]>M[i])
				if(i==T-1)
					printf("Nie");
				else
					printf("Nie\n");
			else
			{
				int nk;
				nk=(N[i]/K[i])+(N[i]%K[i]);
				int k[K[i]][nk];
				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 br,j,Mi,s=0;
						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");
			}	
		}		
	}			
}