using System;

namespace takmicenje
{
    class Program
    {
        static void Main(string[] args)
        {
            long t, i, a;
            string unos;
            string[] razmak;
            t = long.Parse(Console.ReadLine());
            long[] n = new long[t];
            long[] m = new long[t];
            long[] k = new long[t];
            for (i = 0; i < t; i++)
            {
                unos = Console.ReadLine();
                razmak = unos.Split(' ');
                n[i] = long.Parse(razmak[0]);
                m[i] = long.Parse(razmak[1]);
                k[i] = long.Parse(razmak[2]);
            }
            for (i = 0; i < t; i++)
            {
                a = (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;
                if (a <= m[i])
                {
                    Console.WriteLine("Tak");
                }
                else
                {
                    Console.WriteLine("Nie");
                }
            }
        }
    }
}