#include <iostream>

using namespace std;

int main()
{
    int T;
    cin >> T;

    for(int i = 0; i < T; i++){
        long long N, M, K;
        cin >> N >> M >> K;

        long long malaGrupa = N / K;
        long long ostatak = N % K;
        long long minBananica = (malaGrupa+1) * (ostatak * (malaGrupa+2) + (K-ostatak) * malaGrupa) / 2;
        if (minBananica <= M) cout << "Tak" << endl;
        else cout << "Nie" << endl;
    }
}