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

namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            for (int i = 0; i < t; i++)
            {
                string[] s = Console.ReadLine().Split();
                int n = Convert.ToInt32(s[0]);
                int m = Convert.ToInt32(s[1]);
                int k = Convert.ToInt32(s[2]);
                int ostatak = n % k;
                int opg = n / k;
                if (k * opg * (opg + 1) / 2 + ostatak * (opg + 1) > m) Console.WriteLine("Nie");
                else Console.WriteLine("Tak");
            }

        }
    }
}