using System;

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