#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

bool provera(ll n, ll m, ll k) {
    ll pom = n/k;
    ll brBan, p, p1;
    if(k > 1) {
        brBan = (((pom+1)*pom)/2)*(k-1);
        if(brBan > m)
            return false;
        else {
            p = m - brBan;
            p1 = pom + (n - (pom*k));
            if((((p1+1)*p1)/2) <= p)
                return true;
            else
                return false;
        }
    }
    else {
        brBan = (((pom+1)*pom)/2);
        if(brBan > m)
            return false;
        else
            return true;
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll t, n, m, k;
    cin >> t;
    for(int i = 0;i < t;i++) {
        cin >> n >> m >> k;
        if(n > m)
            cout << "Nie\n";
        else if(provera(n, m, k))
            cout << "Tak\n";
        else if(!provera(n, m, k))
            cout << "Nie\n";
    }
    return 0;
}