#include <iostream>
#include <list>
#include <iterator>

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

int main()
{
    int t;
    std::cin >> t;
    std::list<NMK> testovi;

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

    for (std::list <NMK>::iterator i = testovi.begin(); i != testovi.end(); ++i) {
        int n = (*i).n;
        int m = (*i).m;
        int k = (*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";

    }

}