#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ll moda=1000000007;
typedef vector<ll> vl1;
typedef vector<vl1> vl2;
typedef vector<string> vst1;

struct struka
{ll val; ll ind;};
typedef vector<struka> vs1;

bool compa(struka& a, struka& b)
{ if(a.val==b.val) return a.ind<b.ind;
  return a.val<b.val;
}

ll lova(vl1&  veka, ll dole, ll gore, ll val)
{ ll sred;
  while(dole<=gore)
  {sred=(gore+dole)/2;
   if(veka[sred]>=val) gore=sred-1;// real condition !
   else dole=sred+1;
  }
 return dole;
}

ll gcd(ll a,ll b)
{ll t;
  while (b)
  { t= b;
    b = a % b;
    a = t;
  }
return a;
}

ll fast_pow(ll a, ll p)
{ ll res = 1;
  while (p)
   { if ( (p &1) == 0) { a = (a * a); p >>=1; }
     else {  res *=  a;   p--; }
   }
  return res;
}

void radi(ll& q)
{ ll i, j, k, kn, m, n, p, t, l, r, x, y, z, a, b, c, d;
  ll val, pos, tmp, suma, maxa, mina, naso, num, ost;
  string str1;
  char ch1;
  cin>>n>>m>>kn;
  val=n/kn;
  ost=n%kn;
  suma=0;
  if(ost>0) suma+=ost*(val+2)*(val+1)/2;
  suma+=(kn-ost)*(val+1)*val/2;
  if(suma<=m) cout<<"Tak\n"; else cout<<"Nie\n";



}

int main()
{ /*
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(nullptr);
  cout<<fixed<<setprecision(15);
  */

  ll t, q;
  cin>>t;
  //t=1;
  for(q=1;q<=t;q++)
   { // cout<<"Case #"<<q<<": ";
     radi(q);
   }
  return 0;
}
/*
2
5 100 2
2 2 1

12
15 30 5
15 29 5
16 33 5
16 34 5
17 37 5
17 38 5
18 41 5
18 42 5
19 45 5
19 46 5
20 49 5
20 50 5

*/