using System;
using System.Linq;

namespace MyShootingStar
{
    class Program
    {
        public static void Main(String[] args)
        {
            int T = Convert.ToInt32(Console.ReadLine());
            for (int i = 0; i < T; i++)
            {
                string s = Console.ReadLine();
                uint N = Convert.ToUInt32(s.Split(' ')[0]);
                ulong M = Convert.ToUInt64(s.Split(' ')[1]);
                uint K = Convert.ToUInt32(s.Split(' ')[2]);
                if (N >= K)
                {
                    uint x = N / K;
                    uint y = N % K;
                    if (K * x * (x + 1) / 2 + y * (x + 1) <= M)
                        Console.WriteLine("Tak");
                    else
                        Console.WriteLine("Nie");
                }
                else
                    Console.WriteLine("Nie");
            }

        }
    }
}