#include <iostream>
using namespace std;
int
main ()
{
  int T, num_K, ukb;
  cin >> T;
  int nizN[T], nizM[T], nizK[T];
  for (int a = 0; a < T; a++)
    {
      cin >> nizN[a] >> nizM[a] >> nizK[a];
    }
  for (int c = 0; c < T; c++)
    {
      int N = nizN[c], M = nizM[c], K = nizK[c], bpg = 0;
      num_K = N / K;
      for (int b = 1; b <= num_K; b++)
	{
	  bpg = bpg + b;
	}
      ukb = bpg * K + (N % K) * (num_K + 1);
      if (ukb <= M)
	{
	  cout << "Tak" << endl;
	}
      else
	cout << "Nie" << endl;
    }
  return 0;


}