using System;

namespace Ekskurzija
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            int[] n = new int[t];
            int[] m = new int[t];
            int[] k = new int[t];
            for(int i=0;i<t;i++)
            {
                string[] str = Console.ReadLine().Split();
                n[i] = int.Parse(str[0]);
                m[i] = int.Parse(str[1]);
                k[i] = int.Parse(str[2]);
            }
            for(int i=0;i<t;i++)
            {
                if(m[i]>n[i] || (m[i]==n[i] && m[i]==k[i] && n[i]==k[i]))
                {
                    if(k[i]==1)
                    {
                        if(n[i]+1<=2*m[i]/n[i])
                        {
                            Console.WriteLine("Tak");
                        }
                        else
                        {
                            Console.WriteLine("Nie");
                        }
                    }
                    else if(k[i]==2)
                    {
                        if(n[i]%2!=0)
                        {
                            if (2 * m[i] / (n[i] + 2)>=(n[i] + 2) / 2)
                            {
                                Console.WriteLine("Tak");
                            }
                            else
                            {
                                Console.WriteLine("Nie");
                            }
                        }
                        else
                        {
                            if (2 * m[i] / n[i] >= (n[i] + 2) / 2)
                            {
                                Console.WriteLine("Tak");
                            }
                            else
                            {
                                Console.WriteLine("Nie");
                            }
                        }
                    }
                    else if(k[i]>=(n[i]/2)+1)
                    {
                        if(m[i]>=2*n[i]-k[i])
                        {
                            Console.WriteLine("Tak");
                        }
                        else
                        {
                            Console.WriteLine("Nie");
                        }
                    }
                    else
                    {
                        if(m[i]-(n[i]%k[i]*(n[i] / k[i] + 1))<= k[i]*(n[i] / k[i])*(n[i]/k[i]+1)/2)
                        {
                            Console.WriteLine("Tak");
                        }
                        else
                        {
                            Console.WriteLine("Nie");
                        }
                    }
                    
                }
                else
                {
                    Console.WriteLine("Nie");
                }
            }
        }
    }
}