#include <iostream>
using namespace std;

int da(int N, int M, int K)
{
    int o=N/K;
    return (((o*(o-1))/2)*K+N%K==0?0:o+1)<=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";
    }
}