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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int t = Convert.ToInt32(Console.ReadLine());
            int[] a = new int[t];
            int[] b = new int[t];
            int[] c = new int[t];
            for (int i = 0; i < t; i++)
            {
                string[] s = Console.ReadLine().Split();
                a[i] = Convert.ToInt32(s[0]);
                b[i] = Convert.ToInt32(s[1]);
                c[i] = Convert.ToInt32(s[2]);
            }
            for (int i = 0; i < t; i++)
            {
                int x = a[i] / c[i];
                if(c[i]*(x+x*x)/2+(x+1)*(a[i]%c[i])<=b[i])
                    Console.WriteLine("Tak");
                else
                    Console.WriteLine("Nie");
            }
        }
    }
}