#include <iostream>
#include <vector>
#include <numeric>
#include <sstream>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <map>
#include <climits>
#define watch(x) cout << (#x) << " is " << (x) << endl

using namespace std;
typedef long long ll;

string solve(ll n, ll m, ll k)
{
    if(m<n)
        return "Nie";
    else if(n == k)
        return "Tak";
    else if(n%k==0)
    {
        ll x = n/k;
        if(x*(x+1)/2*k > m)
            return "Nie";
    }
    else
    {
        ll x = n/k + 1;
        ll y = n-n/k*k;
        ll y1 = k - y;
        if(x*(x+1)/2*y + (x-1)*x/2*y1 > m)
            return "Nie";
        else
            return "Tak";
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin>>t;
	while(t--)
    {
        ll n, m, k;
        cin>>n>>m>>k;
        cout<<solve(n,m,k)<<"\n";
    }

}