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

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll t,n,m,k;
    cin >> t;
    while (t--)
    {
        cin >> n >> m >> k;
        ll g,r,sum=0,br;
        g=n/k;
        r=n%k;
        sum+=k*((g*(g+1))/2);
        sum+=(g+1)*r;
        cout << (sum<=m?"Tak\n" : "Nie\n");
    }
    return 0;
}