#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        ll n,m,k;
        cin >> n >> m >> k;
        ll p=n/k;
        m-=k*p*(p+1)/2;
        m-=(n%k)*(p+1);
        if (m>=0)
            cout << "Tak\n";
        else
            cout << "Nie\n";
    }
    return 0;
}