#include<bits/stdc++.h>
using namespace std;
 
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);cerr.tie(nullptr);
#define pb push_back
#define PI 3.14159265
#define pii pair<int,int>
//#define f first
//#define s second
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;


int pl[26][200005],pr[26];


void Solve() {
	ll n,m,k;
	cin >> n >> m >> k;
	ll a = n/k;
	ll b=n-a*(k-1);
	if((a*(a+1)*(k-1))/2+(b*(b+1))/2<=m) cout<<"Tak\n";
	else cout<<"Nie\n";
	
}


int main()
{
	//fasti
	int tt;
    cin >> tt;
	while(tt--) {
		Solve();
	}
	
	
}