#include <iostream>

using namespace std;

int main()
{
    long long int t, n, m, k, min1;
    cin >> t;
    while(t--)
    {
        cin >> n;
        cin >> m;
        cin >> k;
        min1 = (n/k) * (n/k+1) * k / 2;
        min1 += (n/k +1) * (n%k);
        if(m >= min1)
        {
            cout << "Tak" << endl;
        }
        else
        {
            cout << "Nie" << endl;
        }
    }
}