// __builtin_popcount(x) broj bitova
// __builtin_popcountll(x) long long
#define here cerr<<"---------------------------\n"
#include <bits/stdc++.h>
#define ld double
#define ll long long
#define ull unsigned long long
#define llinf 100000000000000000LL // 10^17
#define iinf 2000000000 // 2*10^9
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) int(a.size())
#define all(a) a.begin(),a.end()
using namespace std;

ll f(ll x){return x*(x+1)/2;}
int main(){
	ios_base::sync_with_stdio(false);cerr.tie(0);cout.tie(0);cin.tie(0);
    int t;
    cin >> t;
    while(t--){
        ll n,m,k;
        cin >> n >> m >> k;
        ll ans = f(n/k)*k + (n%k)*(n/k+1);
        if(ans<=m) cout<<"Tak"<<endl;
        else cout<<"Nie"<<endl;
    }
	return 0;
}