#include <iostream>
using namespace std;

int da(int N, int M, int K)
{
    int n = N/K;
    int kpg=(n+1)*n/2;
    int k=kpg*K;
    int ki=N-n*K;
    for (int i=0;i<ki;i++) 
        k+=kpg+1;
    return k <= M;
}

int main()
{
    int T;
    cin>>T;
    int a[T];
    for (int i=0;i<T;i++)
    {
        int N,M,K;
        cin>>N>>M>>K;
        a[i]=da(N,M,K);
    }
    for (int i=0;i<T;i++)
    {
        cout<<(a[i] ? "Tak" : "Nie") << "\n";
    }
}