using System;

    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            long[] n = new long[t];
            long[] m = new long[t];
            long[] k = new long[t];
            string [] s = new string[t];
            for (int i = 0; i < t; i++)
            {
                var x = Console.ReadLine().Split(' ');
                n[i] = long.Parse(x[0]);
                m[i] = long.Parse(x[1]);
                k[i] = long.Parse(x[2]);
                if (k[i] > n[i] || (n[i] % k[i]) * ((n[i] / k[i] + 1) * (n[i] / k[i] + 2) / 2) + (k[i] - (n[i] % k[i])) * ((n[i] / k[i]) *((n[i] / k[i]) + 1) / 2) < m[i])
                {
                    s[i] = "Tak";
                }
                else
                {
                    s[i] = "Nie";
                }
            }
            foreach (var v in s)
            {
                Console.WriteLine(v);
            }
              
        }
    }