#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
int main()
{
    int t;
    cin>>t;
    for(int i=0;i<t;i++)
    {
        ll n,m,k;
        cin>>n>>m>>k;
        ll br=n/k;
        ll sum=(((br+1)*br)/2)*k;
        ll ost=n%k;
        sum+=(ost)*(br+1);
        if(sum<=m)
            cout<<"Tak"<<endl;
        else
            cout<<"Nie"<<endl;
    }
    return 0;
}