#include <iostream>
using namespace std;

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

    while(t--){
        int i, n, k;
        long long int m;
        cin >> n >> m >> k;
        
        n--;
        int brKolona =  n / k;
        long long int suma = k * brKolona * (brKolona + 1) / 2;
        int visi = n % k;
        suma += visi *(brKolona + 1);
        cout << ( (m- suma > brKolona)  ? "Tak" : "Nie" )<< endl;
    }
    return 0;
}