using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _B__Ekskurzija
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            List<string> rez = new List<string>();

            for (int i = 0; i < t; i++)
            {
                var ulaz = Console.ReadLine().Split();

                long n = long.Parse(ulaz[0]);
                long m = long.Parse(ulaz[1]);
                long k = long.Parse(ulaz[2]);
                
                long ostatak = n % k;
                long kolicnik = n / k;

                long minimalno = ostatak * ((kolicnik + 1) * (kolicnik + 2) / 2) + (k - ostatak) * (kolicnik * (kolicnik + 1) / 2);

                if (minimalno > m)
                {
                    rez.Add("Nie");
                }
                else
                {
                    rez.Add("Tak");
                }
            }

            foreach(var el in rez)
            {
                Console.WriteLine(el);
            }

        }
    }
}