#include <bits/stdc++.h>

using namespace std;

int main()
{
    int t, n, m, k, temp;
    cin >> t;
    string ispis[t];
    for(int i = 0; i < t; i++)
    {
        cin >> n >> m >> k;
        temp = n/k;
        m -= k * (temp+1) * temp / 2;
        if(m < (temp+1) * (n%k)) ispis[i] = "Nie";
        else ispis[i] = "Tak";
    }
    for(int i = 0; i < t; i++)
        cout << ispis[i] << endl;
    return 0;
}