#include <bits/stdc++.h>
using namespace std;
int T, N, M, K, x, y, zbir;
int main(){
    cin >> T;
    for(int t=1; t<=T; t++){
        cin >> N >> M >> K;
        x=N/K+1;
        y=N%K;
        zbir=K*((x*(x-1))/2)+y*(x+1);
        if(zbir<=M){
            cout << "Tak" << endl;
        }
        else{
            cout << "Nie" << endl;
        }
    }
    return 0;
}