#include <iostream>

using namespace std;

int main()
{
    int T;
    long N[20],M[20],K[20];
    cin>>T;
    for (int i=1; i<=T; i++)
    {
        cin>>N[i]>>M[i]>>K[i];
    }
    for (int i=1; i<=T; i++)
    {
        long d=N[i]/K[i];
        long x=(d+1)*K[i]-N[i];
        long r=x*d*(d+1)/2 + (K[i]-x)*(d+1)*(d+2)/2;
        if (r<=M[i])
        {
            cout<<"Tak"<<endl;
        }
        else
        {
            cout<<"Nie"<<endl;
        }
    }
}