#include <bits/stdc++.h>
	#define ll unsigned long long
	
	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 uf = n % k;
	   	ll of = n / k;
	   	ll rez = (((of + 1) * of) / 2) * k + uf * (of + 1);
	   	if(rez > m) cout << "Nie" << "\n";
	   	else cout << "Tak" << "\n";
	   }
	    return 0; 
	}