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

#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define push_back pb
#define pop_back ppb
#define first fi
#define second se

int main(){
	IOS;
	int t;
	unsigned long long n, k;
	unsigned long long m;
	unsigned long long broj1, broj2;
	unsigned long long koliko1, koliko2;
	
	unsigned long long rez;
	cin >> t;
	
	for(int r=0; r<t; r++){
		cin >> n >> m >> k;
		broj1 = k - n % k;
		koliko1 = n / k;
		broj2 = n % k;
		koliko2 = n / k + 1;
		rez = broj1*(koliko1*(koliko1 + 1)) / 2;
		rez += broj2*(koliko2*(koliko2 + 1)) / 2;
		if(m >= rez) cout << "Tak" << endl;
		else cout << "Nie" << endl;
	}
	
	return 0;
}