using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.SymbolStore;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Net.WebSockets;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;
using System.Numerics;
//using System.Data;
//using System.Drawing;

namespace ConsoleApplication2
{
    class Program
    { 
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            List<string> res = new List<string>();
            while(t-->0)
            {
                var s = Console.ReadLine().Split();
                long n = long.Parse(s[0]);
                long m = long.Parse(s[1]);
                long k = long.Parse(s[2]);
                long kol = n / k;
                long ost = n % k;
                long ans = k * kol * (kol + 1) / 2 + ost * (kol + 1);
                if (ans > m)
                    res.Add("Nie");
                else res.Add("Tak");

            }
            for (int i=0;i<res.Count;i++)
                Console.WriteLine(res[i]);
        }
    }
}