#include <bits/stdc++.h>
using namespace std;

int t;
int n, m, k;
int a, b, c, d, e;

int main()
{
	scanf("%d", &t);
	for (int i = 0; i < t; ++i)
	{
		scanf("%d %d %d", &n, &m, &k);
		a = n/k;
		b = (a*(a+1))/2;
		c = a*b + (n%k)*(a+1);
		if (c <= m)
		{
			printf("Tak\n");
		}
		else
		{
			printf("Nie\n");
		}
	}
	return 0;
}