#include <iostream>
using namespace std;
unsigned long long n, m, k;
int main() {
    cin.tie(NULL);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    while (t--) {
        cin >> n >> m >> k;
        if (k * (n / k) * (n / k + 1) / 2 + (n % k) * (n / k + 1) > m) cout << "Nie\n";
        else cout << "Tak\n";
    }
    return 0;
}