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

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


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

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