#include <iostream>

using namespace std;

int main()
{
	int t;
	cin >> t;
	for (int i = 0; i < t; i++)
	{
		int n, m, k;
		cin >> n >> m >> k;
		int smallerGroup = n / k;
		int biggerGroup = smallerGroup + 1;
		int nBiggerGroups = n % k;
		int nSmallerGroups = k - nBiggerGroups;
		double mForSmallerGroup = (((double)smallerGroup + 1) / 2) * smallerGroup;
		double mForBiggerGroup = (((double)biggerGroup + 1) / 2) * biggerGroup;
		double mTotalSG = mForSmallerGroup * nSmallerGroups;
		double mTotalBG = mForBiggerGroup * nBiggerGroups;
		double mTotal = mTotalSG + mTotalBG;
		if (mTotal > m)
		{
			cout << "Nie\n";
		}
		else
		{
			cout << "Tak\n";
		}
	}
}