#include <bits/stdc++.h>

using namespace std;

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