#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
using namespace std;
int main()
{
    int T, N, K, M, i;
    bool moze = false;
    cin >> T;
    for(i = 0; i < T; i++){
        cin >> N;
        cin >> M;
        cin >> K;
        if(K > N && M < N){
        moze = false;
    }
    else if(K <= N && M > N && M % N == 0){
        moze = true;
    }
    else if(K <= N && M > N && M % N != 0){
        moze = false;
    }
    else if(K == 1 && M == N){
        moze = false;
    }
    else if(K == 1 && M == 1 && N == 1){
        moze = true;
    }
    else if(K = N && M == N){
        moze = true;
    }
    cout << (moze ? "Tak" : "Nie") << endl;
    }
}