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

void solve() {
    long long n, m, k; cin >> n >> m >> k;
    long long x = n / k, s = x * (x + 1) / 2;
    if (k * s + n % k * (x + 1) <= m) {
        cout << "Tak" << endl; return;
    }
    cout << "Nie" << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int t; cin >> t;
    while (t--) {
        solve();
    }
}