#include<bits/stdc++.h>
using namespace std;
unsigned long long t,n[100000000],m[10000000],k[100000000];
long long brojljudi[10000000],ostatak,zbir;
int main ()
{
  cin >> t;
  for(int i=1; i<=t; i++)
  {
    cin >> n[i] >> m[i] >> k[i];
  }
  for(int i=1; i<=t; i++)
  {
      brojljudi[i]=n[i]/k[i];
      ostatak=n[i]-(brojljudi[i]*k[i]);

      for(int j=1; j<=brojljudi[i]; j++)
      {
          zbir=zbir+j;
      }
      zbir=zbir*k[i];
      for(int j=brojljudi[i]; j<=brojljudi[i]+ostatak; j++)
      {
          zbir=zbir+j;
      }
      if(zbir<=m[i])
      {
        cout << "Tak" << endl;
      }
      else
      {
        cout << "Nie" << endl;
      }
  }
}