using System;

namespace Palindrom_safl
{
    class Program
    {
        static void Ispis(int N, int M, int K)
        {
            if (K > N || M < N)
            {
                Console.WriteLine("Nie");
            }
            else
            {
                int K1 = K;
                int br = 1;
                while (N > 0) 
                {
                    if (K1 == 0) { K1 = K; br++; }
                    M -= br;
                    K1--; N--;
                }
                if (M < 0) Console.WriteLine("Nie");
                else Console.WriteLine("Tak");
            }
        }
        static void Main(string[] args)
        {
            int T = Convert.ToInt32(Console.ReadLine());
            int[,] Tt = new int[T, 3];
            for (int red = 0; red < T; red++)
            {
                string[] b = Console.ReadLine().Split();
                for (int kol = 0; kol < 3; kol++)
                    Tt[red, kol] = Convert.ToInt32(b[kol]);
            }
            for (int i = 0; i < T; i++) Ispis(Tt[i, 0], Tt[i, 1], Tt[i, 2]);
        }
    }
}