#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 min3 = (n / k) + 1;
    ll sum;
    if (n % k > 0) sum = ((min3 * (1 + min3)) / 2) * (n % k) + ((min1 * (1 + min1)) / 2) * (k - n % k);
    else sum = ((min1 * (1 + min1)) / 2) * k;
    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;
    }

}