#include <iostream>
#include <iomanip>

using namespace std;

struct ucenik
{
    unsigned n,k;
    unsigned long long m;
};

void unos(ucenik u[],unsigned t)
{
    for(int i=0;i<t;i++)
        cin>>u[i].n>>u[i].m>>u[i].k;
}

void olovka(ucenik u[],unsigned t)
{
    int zbir=0,x;
    for(int i=0;i<t;i++)
    {
        int zp = u[i].k - (u[i].n % u[i].k);
        int pp = u[i].n/u[i].k;
        for(int j=0;j<u[i].k;j++)
        {

            if(j>= zp)
            {
                x=pp+1;
                //cout<<x<<" ";
                zbir=zbir+x*(x+1)/2;
            }

            //cout<<(pp + 1)<<" ";
            else
            {
                x=pp;
                //cout<<x<<" ";
                zbir=zbir+x*(x+1)/2;
            }
        }
        if(zbir<=u[i].m)
            cout<<"Tak"<<endl;
        else
            cout<<"Nie"<<endl;
    }
}

int main()
{
    ios::sync_with_stdio(false);
    unsigned t;
    cin>>t;
    ucenik u[t];
    unos(u,t);
    olovka(u,t);

    return 0;
}