using System;

    class Program
    {
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            int[] n = new int[t];
            int[] m = new int[t];
            int[] k = new int[t];
            for (int i = 0; i < t; i++)
            {
                var x = Console.ReadLine().Split(' ');
                n[i] = int.Parse(x[0]);
                m[i] = int.Parse(x[1]);
                k[i] = int.Parse(x[2]);
                if (n[i] > k[i])
                {
                    if (k[i] % m[i] < n[i] % m[i])
                    {
                        Console.WriteLine("Tak");
                    }
                    else
                    {
                        Console.WriteLine("Nie");
                    }
                }
                else
                {
                    Console.WriteLine("Nie");
                }
            }
              
        }
    }