#include <iostream>
#include <cmath>
#include <vector>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    
    int n, m, k, t;
    cin >> t;
    for (int i = 0; i < t; i++) {
        cin >> n >> m >> k;
        int proba = ceil((double)n / k);
        int pogresni = proba * k - n;
        int dobri = k - pogresni;
        int suma_dobrih = dobri * ((proba * (proba + 1)) / 2);
        int suma_losih = pogresni * (((proba - 1) * proba) / 2);
        int ukupna_suma = suma_dobrih + suma_losih;
        cout << (ukupna_suma <= m ? "Tak" : "Nie") << endl;
    }
}