#include <iostream>
using namespace std;

int main() {
    int t, n, m, k, a, rez = 0, j = 0;
    cin >> t;
    for (int z = 0; z < t; z++) {
        cin >> n >> m >> k;  
        for (int i = 0; i < n; i += k) {
            if (k - i < n) rez += (k - (i % k)) * (1 + j);
            else rez += k * (1 + j);
            j++;
        } if (rez > m) cout << "Nie" << endl;
        else cout << "Tak" << endl;
    }
}