#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll n,m,k;
        cin>>n>>m>>k;
        ll d=n/k,o=n%k;
        ll mn=0;
        mn=mn+k*d*(d+1)/2;
        mn=mn+o*(d+1);
        cout<<(mn<=m?"Tak":"Nie")<<endl;
    }
    return 0;
}