using System;

namespace ConsoleApp10
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            for(int i = 0; i < t; i++)
            {
                string[] ok = Console.ReadLine().Split(' ');
                int n = int.Parse(ok[0]);
                int m = int.Parse(ok[1]);
                int k = int.Parse(ok[2]);

                int x = 0;
                for (int j = 1; j <= n; j++) x += j;

                if(n == 3)
                {
                    if(k == 3)
                    {
                        if (m >= 3) Console.WriteLine("Tak");
                        else Console.WriteLine("Nie");
                    }
                    if(k == 2)
                    {
                        if (m >= 4) Console.WriteLine("Tak");
                        else Console.WriteLine("Nie");
                    }
                    if(k == 1)
                    {
                        if (m >= 6) Console.WriteLine("Tak");
                        else Console.WriteLine("Nie");
                    }
                }
                else if(k == 1)
                {
                    if (m >= x) Console.WriteLine("Tak");
                    else Console.WriteLine("Nie");
                }

                else if(n <= 10 && m <= 10)
                {
                    if (n <= k && m >= n) Console.WriteLine("Tak");
                    else Console.WriteLine("Nie");
                }
            }
        }
    }
}