#import <iostream>
#import <cmath>
using namespace std;

int main(){
    int t;
    cin >> t;
    for(int i = 0; i < t; i++){
        long long int n, m, k;
        cin >> n >> m >> k;
        long long int ceo = n / k;
        long long int ost = n % k;
        long long int br = ((ceo * (ceo + 1))/2) * k + (ceo + 1) * ost;
        if(br > m){
            cout << "Nie" << endl;
        }else{
            cout << "Tak" << endl;
        }
    }
}