#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long T, N, M, Mmin, K, n, x;
    cin >> T;
    while(T--)
    {
        cin >> N >> M >> K;
        x = N/K;
        n = N%K;
        Mmin = n*(x + 1)*(x + 2)/2 + (K - n)*x*(x + 1)/2;
        if(M < Mmin) cout << "Nie" << endl;
        else cout << "Tak" << endl;
    }
    return 0;
}