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

namespace ConsoleApp3
{
    internal class Program
    {
        static Int64 minGrupa(Int64 n)
        {
            if (n == 0) return 0;
            return minGrupa(n - 1) + n;
        }
        static bool takNie(Int64 n,Int64 m,Int64 k)
        {
            return m > (minGrupa(n / k) * k + (n / k + 1) * (n % k));
        }
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            for(int i = 0; i < t; i++)
            {
                string[] st = Console.ReadLine().Split();
                Int64 n = Int64.Parse(st[0]), m = Int64.Parse(st[1]), k = Int64.Parse(st[2]);
                if (takNie(n, m, k)) Console.WriteLine("Tak");
                else Console.WriteLine("Nie");    
            }
            Console.ReadLine();
        }
    }
}