using System;

    class cppboljiodcs
    {
        static void unos(out long n, out long bananice, out long k)
        {
            string[] n_bananice_k = Console.ReadLine().Split();
            n = long.Parse(n_bananice_k[0]);
            bananice = long.Parse(n_bananice_k[1]);
            k = long.Parse(n_bananice_k[2]);
        }
        static void Main()
        {
            int t = int.Parse(Console.ReadLine());
            long n, bananice, k;
            string[] ispis = new string[t];

            for (int i = 0; i < t; i++)
            {
                unos(out n, out bananice, out k);
                if (k == 1)
                {
                    if (n + 1 <= 2 * bananice / n)
                        ispis[i] = "Tak";
                    else
                      ispis[i] = "Nie"; 
                }
                else if (k == 2)
                {
                    if (n % 2 == 0)
                    {
                        if ((n + 2) / 2 <= 2 * bananice / n)
                            ispis[i] = "Tak";
                        else 
                            ispis[i] = "Nie";
                    }
                    else
                    {
                        if ((n + 2) / 2 <= (2 * bananice) / (n + 2)) 
                            ispis[i] = "Tak"; 
                        else
                            ispis[i] = "Nie";
                    }
                }
                else if (k >= (Math.Ceiling(n / 2.0)))
                {
                    if (n + n <= bananice+k) 
                        ispis[i] = "Tak";
                    else  
                        ispis[i] = "Nie"; 
                }
                else
                {
                    long x = n / k;
                    long y = n % k;
                    if ((k * x * (x + 1) / 2) <= bananice - (y * (x + 1)))  
                        ispis[i] = "Tak";
                    else  
                        ispis[i] = "Nie"; 
                }
            }
            for (int i = 0; i < t; i++)
            {
                Console.WriteLine(ispis[i]);
            }

        }
    }


/*
 *     static int nzd(int a, int b)
    {
        int temp;
        while(b!=0)
        {
            temp = a;
            a = b;
            b = temp % b;
        }
        return a;
    }
    */