#import <iostream>
#import <cmath>
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 ceo = n / k;
        int ost = n % k;
        int br = ((ceo * (ceo + 1))/2) * k + (ceo + 1) * ost;
        if(br > m){
            cout << "Nie" << endl;
        }else{
            cout << "Tak" << endl;
        }
    }
}