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();
                int N = Convert.ToInt32(s.Split(' ')[0]);
                int M = Convert.ToInt32(s.Split(' ')[1]);
                int K = Convert.ToInt32(s.Split(' ')[2]);
                if (N >= K)
                {
                    int x = N / K;
                    int y = N % K;
                    if (x * (x + 1) / 2 + y * (x + 1) <= M)
                        Console.WriteLine("Tak");
                    else
                        Console.WriteLine("Nie");
                }
                else
                    Console.WriteLine("Nie");
            }

        }
    }
}