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

namespace ConsoleApplication1
{
    class Program
    {
        class troclan
        {
            public int n;
            public int m;
            public int k;
        }
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());
            troclan[] p = new troclan[t];
            for (int i = 0; i < t; i++)
            {
                p[i] = new troclan();
                string[] s = Console.ReadLine().Split();
                p[i].n = int.Parse(s[0]);
                p[i].m = int.Parse(s[1]);
                p[i].k = int.Parse(s[2]);
            }
            for (int i = 0; i < t; i++)
            {
                int cl_po_gr = p[i].n / p[i].k;
                int zbir = p[i].k * (cl_po_gr * (1 + cl_po_gr) / 2);
                if ((p[i].m - zbir) >= (cl_po_gr + 1) * (p[i].n % p[i].k))
                {
                    Console.WriteLine("Tak");
                }
                else
                    Console.WriteLine("Nie");
            }
        }
    }
}