#include <bits/stdc++.h>

using namespace std;

void resi()
{
    long long n, m, k;
    cin >> n >> m >> k;
    int pogrupi = (n / k + 1)*(n / k) / 2;
    if(k * pogrupi + (n % k) * (n/k + 1) <= m) cout << "Tak" << endl;
    else cout << "Nie" << endl;

}

int main()
{
    int r;
    cin >> r;
    while(r--)
        resi();
}