using System;

namespace zadatak2
{
    class Program
    {
        static void Main(string[] args)
        {
            long t = Convert.ToInt64(Console.ReadLine());
            for(int i=0;i<t;i++)
            {
                string[] ulaz = Console.ReadLine().Split();
                long n = Convert.ToInt64(ulaz[0]);
                long m = Convert.ToInt64(ulaz[1]);
                long k = Convert.ToInt64(ulaz[2]);
                long p = n / k;
                long zbir = k * p * (p + 1) / 2;
                zbir += (p + 1) * (n % k);
                if (zbir <= m) Console.WriteLine("Tak");
                else Console.WriteLine("Nie");
            }
            
        }
    }
}