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

namespace Ekskurzija
{
    internal class Program
    {

        static void Main(string[] args)
        {
           
            int t = int.Parse(Console.ReadLine());
            string[] vs = new string[t];
            for (int i = 0; i < t; i++)
            {

                string[] s = Console.ReadLine().Split();
                long n = long.Parse(s[0]);
                long m = long.Parse(s[1]);
                long k = long.Parse(s[2]);

                if (m < k * ((n / k) * (n / k + 1) / 2) + (n % k) * (n / k + 1)) vs[i] = "Nie";
                else vs[i] = "Tak";

            }
            for (int i = 0; i < t; i++)
            {
                Console.WriteLine(vs[i]);
            }

        }
    }
}