#include <iostream>
#include <bits/stdc++.h>

using namespace std;

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