using System;

namespace zadaci
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int T = Convert.ToInt32(Console.ReadLine()); //testovi

            int[] N = new int[T]; //djaci
            int[] M = new int[T]; //bananice
            int[] K = new int[T]; //grupe

            for (int i = 0; i < T; i++)
            {
                string[] temp1 = Console.ReadLine().Split(' ');
                N[i] = Convert.ToInt32(temp1[0]);
                M[i] = Convert.ToInt32(temp1[1]);
                K[i] = Convert.ToInt32(temp1[2]);
            }

            for (int i = 0; i < T; i++)
            {
                int ost = N[i] % K[i];
                int djakPoGrup = N[i] / K[i];

                int j = 0;
                for (; j < djakPoGrup; j++)
                {
                    M[i] = M[i] - (j + 1) * K[i];
                }

                M[i] = M[i] - (j + 1) * ost;

                if (M[i] < 0)
                    Console.WriteLine("Nie");
                else
                    Console.WriteLine("Tak");
            }

            //Console.ReadLine();

        }
    }
}