#include <bits/stdc++.h>

using namespace std;

int main()
{
    int T;
    long long N,M,K;
    cin >> T;
    for(int t = 0;t<T;t++)
    {
        cin >> N >> M >> K;
        long long maxbr = N/K;
        long long res = ((maxbr*(maxbr+1))/2)*K;
        long long ostatak = N - (N/K)*K;
        res+= (maxbr+1)*ostatak;
        //cout << res << endl;
        if(res <= M)
            cout << "Tak" << endl;
        else
            cout << "Nie" << endl;
    }
    return 0;
}