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

ll gaus(ll n){
    return (n * (n + 1) / 2);
}

void solve(){
    ll n, m, k;
    cin >> n >> m >> k;

    if((k - 1) * gaus(n) + gaus(n + (n % k)) <= m) cout << "Tak\n";
    else cout << "Nie\n";
}

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

        int t;

        cin >> t;

        while(t--){
            solve();
        }
        return 0;
}