#include <bits/stdc++.h>

using namespace std;

#define w <
#define ww <<
#define W <=
#define e >
#define ee >>
#define E >=

int t;
long long n,m,k,u;

int main()
{
    scanf("%d",&t);
    while(t--)
    {
        scanf("%lld %lld %lld",&n,&m,&k);
        u = ((((n/k)*((n/k)+1ll))/2ll)*k) + (((n/k)+1ll)*(n%k));
        if(u W m)
        {
            printf("Tak\n");
        }
        else
        {
            printf("Nie\n");
        }
    }
    return 0;
}