#include <iostream>

using namespace std;

int main()
{
int t, n, m, k, x, l;
cin>>t;
for(int i=1; i<=t; i++)
{
    cin>>n>>m>>k;
    x=n/k;
    l=k-(n%k);
    if((x*(x+1)*l)/2 + ((n%k)*(x+1)*(x+2))/2 <= m)
        cout<<"Tak"<<endl;
    else cout<<"Nie"<<endl;
}
}