using System;
using System.Collections.Generic;
using System.Linq;

namespace MyApp
{
    public class Program
    {
        static int getSum(int n)
        {
            if (n == 0) return 0;
            return n + getSum(n - 1);
        }
        public static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            bool[] results = new bool[t];
            for (int i = 0; i < t; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                int n = int.Parse(s[0]);
                int m = int.Parse(s[1]);
                int k = int.Parse(s[2]);
                int min = 0;
                if(n % k > 0)
                {
                    min = getSum(n / k) * k + getSum(n / k) * (n % k);
                }
                else min = getSum(n / k) * k;
                if (m >= min) results[i] = true;
                else results[i] = false;
            }
            foreach (bool x in results) if (x) Console.WriteLine("Tak");
                else Console.WriteLine("Nie");
        }
    }
}