#include <bits/stdc++.h>

#define ll long long

using namespace std;

void solve() {

    ll n, m, k;
    cin >> n >> m >> k;

    ll x = n / k, mod = n % k;
    ll mx = k * (x * (x + 1) / 2) + mod * (x + 1);

    if(mx <= m)
        cout << "Tak" << endl;
    else
        cout << "Nie" << endl;
}

int main() {

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

    int t;
    cin >> t;
    
    while(t--)
        solve();
    return 0;
}