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

using ll = long long;
using ld = long double;

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int t;
    cin >> t;
    while(t--){
        ll n, m, k;
        cin >> n >> m >> k;
        ll per = n/k;
        ll ost = n%k;
        m -= ost*(per+1)*(per+2)/2;
        m -= (k - ost)*per*(per+1)/2;
        if(m >= 0) cout << "Tak\n";
        else cout << "Nie\n";
    }
    return 0;
}