#include <bits/stdc++.h>

using namespace std;

int main() {

  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  int q;
  long long n, m, k;
  cin>>q;
  for(int i = 0 ; i < q ; i++) {

    cin>>n>>m>>k;
    if(n%k == 0)
    {

      long long t = n/k;
      long long z = (t*(t+1))/2;
      long long x = z * k;

      if(x > m) cout<<"Nie\n";
      else cout<<"Tak\n";

    }
    else
    {

      long long t1 = n/k;
      long long t2 = n%k;

      long long z1 = (t1*(t1+1))/2;
      long long z2 = (t2*(t2+1)/2);

      long long z = z1 + z2;
      long long x = z * k;

      if(x > m) cout<<"Nie\n";
      else cout<<"Tak\n"; 

    }

  }

  return 0;
}