#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool moguce(ll n, long long m, ll k) {
    if (k > n) return false;
    ll min1 = n / k;
    ll min2 = min1 + n % k;
    ll sum = ((min1 * (1 + min1)) / 2) * (k - 1) + (min2 * (1 + min2)) / 2;
    if (sum <= m) return true;
    else return false;
}
int main()
{
    int t;
    ll n, k;
    ll m;
    cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> n >> m >> k;
        moguce(n, m, k) ? cout << "Tak" <<endl : cout << "Nie" << endl;
    }

}