#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mk make_pair
#define v_sort(x) sort(x.begin(),x.end())
#define v_gsort(x) sort(x.begin(),x.end(),greater<ll>())
#define v_find(x,num) find(x.begin(),x.end(),num)
#define PI 3.14159265
#define MOD 1000000007
#define MOD1 998244353
#define INF 1e18;

using namespace std;

void Solve(){
  ll n,m,k;
  cin>>n>>m>>k;
  ll need=n/k;
  n-=need*k;
  need=need*(need+1)/2;
  cout<<(m>=need*k+n*(n+1)/2?"Tak\n":"Nie\n");
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int t=1;
//  freopen("input.txt","r",stdin);
//  freopen("output.txt","w",stdout);
  cin>>t;
  while(t--){
    Solve();
  }
  return 0;
}