#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

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;
}