#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cerr.tie(NULL);
    cout.tie(NULL);

    int t, i;
    cin >> t;
    int n, m, k;
    for(i=0;i<t;i++)
    {
        cin >> n >> m >> k;

        if(n%k==0 && m<(k*((n/k)*(n/k+1))/2))
            cout << "Nie" << endl;
        else if(n%k!=0 && m<(((k*((n/k)*(n/k+1))/2)) + ((n-(k*(n/k)))*(n/k+1))))
            cout << "Nie" << endl;
        else
            cout << "Tak" << endl;
    }
    return 0;
}