using System;

namespace drugiKrugDrugi
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            string[] sol = new string[t];

            for (int i = 0; i < t; i++)
            {
                string[] input = Console.ReadLine().Split();
                int n = Convert.ToInt32(input[0]);
                int m = Convert.ToInt32(input[1]);
                int k = Convert.ToInt32(input[2]);

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