#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll rijesi(ll k)
{
    if(k%2==0)
    {
        return (k/2)*(k+1);
    }
    else
    {
        return ((k+1)/2)*k;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--)
    {
        ll n,m,k;
        cin>>n>>m>>k;
        ll ful=n/k;
        ll ostatak=n%k;
        ll kolko=rijesi(ful)*k;
        kolko+=ostatak*(ful+1);
        if(kolko<=m) cout<<"Tak"<<'\n';
        else cout<<"Nie"<<'\n';
    }
}