#include <iostream>

#define ll long long

using namespace std;

int main()
{
    int t;
    cin>>t;
    ll n,m,k;
    while(t)
    {
        t--;
        cin>>n>>m>>k;
        ll nk = n/k;
        ll visak=n-nk*k;
        ll l = k*nk*(nk+1)/2 + visak* (nk+1);
        if(l<=m)
            cout<<"Tak"<<endl;
        else
            cout<<"Nie"<<endl;
    }
    return 0;
}