using System;
using System.Collections.Generic;

namespace drugizadatak
{
    class Program
    {       
        static void Main(string[] args)
        {
           
            int n = int.Parse(Console.ReadLine());
            int[] N = new int[n];
            int[] M = new int[n];
            int[] K = new int[n];
            int a = 0;
            int b = 0;
            for(int i = 0; i < n; i++)
            {
                string[] s = Console.ReadLine().Split();
                N[i] = int.Parse(s[0]);
                M[i] = int.Parse(s[1]);
                K[i] = int.Parse(s[2]);
            }
            for(int i = 0; i < n; i++)
            {
                a = N[i] / K[i];
                b = N[i] % K[i];
                if (K[i] <= N[i])
                {
                    if ((K[i] - b) * (a * (a + 1)) / 2 + b * (a + 1) * (a + 2) / 2 > M[i]) Console.WriteLine("Nie");
                    else Console.WriteLine("Tak");
                }
                else
                    Console.WriteLine("Nie");
            }

        }
    }
}