#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
using namespace std;

const char nl='\n';
const int MOD=1000000007;
const int N=200005;

ll sum(ll gr){
   return (gr*(gr+1))/2;
}

ll n,m,k,vel,res,ost;

void solve(){
    cin>>n>>m>>k;
    vel=n/k;
    ost=n%k;
    res=(k-1)*sum(vel)+sum(vel+ost);
    if(res<=m)cout<<"Tak"<<nl;
    else cout<<"Nie"<<nl;
}
int main () {
cin.tie(NULL);
ios_base::sync_with_stdio(false);

int T=1;
cin>>T;
while(T--){
    solve();
}

return 0;
}