/******************************************************************************

                            Online C# Compiler.
                Code, Compile, Run and Debug C# program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/
using System;

namespace ConsoleApp8
{
	class Program
	{
		static void Main(string[] args)
		{
			int t = int.Parse(Console.ReadLine());
			string[] resenja = new string[t];
			for(int i=0; i<t; i++) 
			{
				var nmk = Console.ReadLine().Split();
				ulong n = ulong.Parse(nmk[0]);
				ulong m = ulong.Parse(nmk[1]);
				ulong k = ulong.Parse(nmk[2]);
				if (k == 1)
				{
					if (n + 1 <= 2*m / n) { resenja[i] = "Tak"; }
					else { resenja[i] = "Nie"; }
				}
				else if (k == 2)
				{
					if (n % 2 == 0)
					{
						if ((n + 2) / 2 <= 2 * m / n) { resenja[i] = "Tak"; }
						else { resenja[i] = "Nie"; }
					}
					else
					{
						if ((n + 2) / 2 <= (2 * m) / (n + 2)) { resenja[i] = "Tak"; }
						else { resenja[i] = "Nie"; }
					}
				}
				else if (k >= (Math.Ceiling(n / 2.0))) 
				{
                    if (n + n - k <= m) { resenja[i] = "Tak"; }
					else { resenja[i] = "Nie"; }

				}
				else
				{
					ulong x = n/k;
					ulong y=n%k;
                    if ((k*x*(x+1)/2)<=m-(y*(x+1))) { resenja[i] = "Tak"; }
                    else { resenja[i] = "Nie"; }
				}
			}
			for(int j=0; j<t; j++)
            {
				Console.WriteLine(resenja[j]);
            }


		}
	}
}