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

namespace Ekskurzija
{
    class Program
    {
        static long Zbir(long a, long b)
        {
            return b * a + b * (b - 1) / 2;
        }
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            for (int i = 0; i < t; i++)
            {
                string[] s = Console.ReadLine().Split();
                long n = long.Parse(s[0]);
                long m = long.Parse(s[1]);
                long k = long.Parse(s[2]);
                long n1 = n / k;
                long no = n % k;
                long z = k * Zbir(1, n1) + no * (n1 + 1);
                Console.WriteLine(z <= m ? "Tak" : "Nie");
            }
        }
    }
}