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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int T = int.Parse(Console.ReadLine());
            string[] s = new string[T];
            for(int i =0; i < T; i++)
            {
                string[] x1 = Console.ReadLine().Split();
                int N = int.Parse(x1[0]);
                int M = int.Parse(x1[1]);
                int K = int.Parse(x1[2]);

                int Y = N / K;
                int X = N % K;

                /*if(((X*(Y+1)*(Y+2))/2) + ((K-X)*Y*(Y+1)/2) <= M)
                {
                    Console.WriteLine("Tak");
                }
                else Console.WriteLine("Nie");*/
                if (((X * (Y + 1) * (Y + 2)) / 2) + ((K - X) * Y * (Y + 1) / 2) <= M)
                {
                    s[i] = "Tak";
                }
                else s[i] = "Nie";
            }
           for(int i = 0; i < T; i++)
            {
                Console.WriteLine(s[i]);
            }
        
        }
    }
}