#include <bits/stdc++.h>
#define en '\n'
#define ll long long
#define sp " "

using namespace std;

int main()
{
    int T;
    cin >> T;
    while (T--)
    {
        ll N, M, K;
        cin >> N >> M >> K;
        ll a = N / K;
        ll b = N % K;
        ll sum = K * ((a * (a + 1)) / 2) + b * (a + 1);
        if (sum <= M)
            cout << "Tak" << en;
        else
            cout << "Nie" << en;
    }
}