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

namespace drugiZadatak
{
    class Program
    {
        static void Main(string[] args)
        {
            int tc = int.Parse(Console.ReadLine());

            bool[] rezultat = new bool[tc];

            int t = 0;
            while(t < tc)
            {
                string[] s = Console.ReadLine().Split();
                int n = int.Parse(s[0]);
                int m = int.Parse(s[1]);
                int k = int.Parse(s[2]);

                int d = n / k;
                int brVeci = n % k;

                long potrebneBombone = d * (d + 1) * (k - brVeci) + (d + 1) * (d + 2) * brVeci;

                potrebneBombone /= 2;

                if (potrebneBombone <= m)
                {
                    rezultat[t] = true;
                }
                else
                {
                    rezultat[t] = false;
                }

                t++;
            }

            for (int i = 0; i < tc; i++)
            {
                if (rezultat[i])
                {
                    Console.WriteLine("Tak");
                }
                else
                {
                    Console.WriteLine("Nie");
                }
            }
        }
    }
}