#include <iostream>

using namespace std;

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    long long int t, n, m, k;

    cin >> t;
    while(t--)
    {
        cin >> n >> m >> k;

        if( (n%k)*((n/k+1)*(n/k+2) / 2) + (k - n%k)*((n/k)*(n/k+1) / 2) > m )
            cout << "Nie\n";
        else
            cout << "Tak\n";
    }

    return 0;
}