#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	ll t;
	ll n,m,k;
	cin>>t;
	while(t--){
        cin>>n>>m>>k;
        ll y=0;
        if(m>(((1+n/k)*(n/k)*(n/k)/2)+(n/k+1)*(n%k)))
            cout<<"Tak\n";
        else
            cout<<"Nie\n";
	}



	return 0;
}