#include <iostream>

using namespace std;

bool testiranje() {
    long long n, m, k;
    cin >> n >> m >> k;
    long long zbir = 0;
    zbir += n % k * ((n / k + 1) * (n / k + 2)) / 2;
    zbir += (k - (n % k)) * ((n / k * (n / k + 1)) / 2);
    if (zbir > m) return false;
    else return true;
}

int main() {
    int t;
    cin >> t;
    bool r[t] = {0};
    for (int i = 0; i < t; i++) r[i] = testiranje();
    for (int i = 0; i < t; i++) {
        if (r[i] == true)
            cout << "Tak";
        else
            cout << "Nie";
        cout << endl; }
}