using System;
namespace Ekskurzija
{
    class Program
    {
        static void Main(string[] args)
        {
            long T = long.Parse(Console.ReadLine());
            long N = 0;
            long M = 0;
            long K = 0;
            for (long i = 0; i < T; i++)
            {
                string s = Console.ReadLine();
                string [] podaci = s.Split(' ');
                N= long.Parse(podaci[0]);
                M= long.Parse(podaci[1]);
                K= long.Parse(podaci[2]);

                long minimalno = minbanana(N, K);
                if (M < minimalno) Console.WriteLine("Nie");
                else Console.WriteLine("Tak");


            }
        }
        static long brbanana(long br)
        {
            return (br + 1) * (br / 2);
        }
        static long minbanana(long br, long brgr)
        {
            long ost = br % brgr;
            long delj = br / brgr;
            long a = 0;
            long b = 0;
            a = brgr - ost; //delj
            b = ost; //delj + 1

            return a * brbanana(delj) + b * brbanana(delj+1);
        }
    }
}