#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define endl "\n"

using namespace std;

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

    ll vrh1 = n/k;
    ll vrh2 = vrh1 + 1;

    ll cnt2 = n - vrh1*k;
    ll cnt1 = k - cnt2;

    ll t = (vrh1*(vrh1+1)) / 2;
    m -= cnt1 * t;

    t = (vrh2*(vrh2+1)) / 2;
    m -= cnt2 * t;

    cout << (m>=0 ? "Tak" : "Nie") << endl;
}

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

    int t=1; cin >> t;

    while(t--)
        solve();

    return 0;
}