using System;
using System.Numerics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            BigInteger M, N, K;
            bool[] a = new bool[10];
            int T = int.Parse(Console.ReadLine());
            for (int i = 0; i < T; i++)
            {
                string[] str = Console.ReadLine().Split();
                N = int.Parse(str[0]);
                M = int.Parse(str[1]);
                K = int.Parse(str[2]);
                if (M > (N / K * (N / K + 1) / 2 * K) + (N % K * (N / K + 1))) a[i] = true;
                else a[i] = false;
            }
            for (int i = 0; i < T; i++)
            {
                if (a[i]) Console.WriteLine("Tak");
                else Console.WriteLine("Nie");
            }    
        }
    }
}