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

namespace takprog
{
    class Program
    {
        static void Main(string[] args)
        {
            int zbir = 0;
            int t = Convert.ToInt32(Console.ReadLine());
            for (int j = 0; j < t; j++)
            {
                string[] p = Console.ReadLine().Split();

                int n = Convert.ToInt32(p[0]);
                int m = Convert.ToInt32(p[1]);
                int k = Convert.ToInt32(p[2]);


                if (k > n || n > m)
                    Console.WriteLine("Nie");
                else if(n==k && k<=m)
                    Console.WriteLine("Tak");
                else
                {
                    int r = n;
                    int s = 0, l = 0;
                    s = n / k + 1;
                    l = n / k;
                    if (n % k != 0)
                    {
                        for (int i = k; i > 0; i--)
                        {
                            if (r == i * l)
                            {
                                zbir += i * l * (l + 1) / 2;
                                break;
                            }
                            else
                            {
                                zbir += s * (s + 1) / 2;
                                r -= s;
                            }
                        }
                    }
                    else
                    {
                        zbir += k * l * (l + 1) / 2;
                    }
                    if (zbir <= m)
                        Console.WriteLine("Tak");
                    else
                        Console.WriteLine("Nie");
                }
            }
            Console.ReadLine();
        }
    }
}