#include <iostream>

using namespace std;

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

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

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