#include <iostream>
#include <cmath>
using namespace std;

int suma(int n)
{
    return ((n*(n+1))/2);
}

int main()
{
    int t,n,k,i,s,j,l=0;
    long long m;
    cin>>t;
    bool a[11];
    while(t!=0)
    {
    cin>>n;
    cin>>m;
    cin>>k;
    i=n/k;
    j=n%k;
    s=(k-j)*suma(i)+j*suma(i+1);
    if(s<=m)
        a[l]=true;
    else
        a[l]=false;
        l++;
        t--;
    }
    for(i=0;i<l;i++)
    {
        if(a[i]==true)
            cout<<"Tak"<<endl;
        else
            cout<<"Nie"<<endl;
    }
    return 0;
}