#include <bits/stdc++.h>
#define MAXN 100010
#define pb push_back
#define ll long long
#define fi first
#define se second
#define mp make_pair

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	int t;
	cin >> t;
	while(t--)
	{
        ll n, m, k;
        cin >> n >> m >> k;
        ll p = n / k;
        ll r = n % k;
        if (m >= p * (p+1) / 2 * (k - r) + (p+1) * (p+2) / 2 * r)
            cout << "Tak\n";
        else
            cout << "Nie\n";
	}
	return 0;
}