#include <iostream>

struct NMK {
    int n, k;
    long long m;
};

int main()
{
    int t;
    std::cin >> t;
    NMK nmk[10];

    for (int i = 0; i < t; ++i) {
        std::cin >> nmk[i].n >> nmk[i].m >> nmk[i].k;
    }

    for (int i = 0; i < t; ++i) {
        int n = nmk[i].n;
        int m = nmk[i].m;
        int k = nmk[i].k;

        int b = ((n % k) * (((n / k) + 1) * ((n / k) + 2)) / 2) + ((k - (n % k)) * (((n / k) * ((n / k) + 1)) / 2));
        if (m - b >= 0) std::cout << "Tak\n";
        else std::cout << "Nie\n";

    }

}