#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int t;
    cin>>t;
    bool res[11]={false};
    for(int i=0; i<t; i++)
    {
        long long n, m, k;
        cin>>n>>m>>k;
        long long brdpgr=n/k;
        long long visak=n-brdpgr*k;
        long long minbrban=0;
        minbrban+=visak*((brdpgr+1)*(brdpgr+2))/2;
        minbrban+=(n-visak)*((brdpgr+1)*brdpgr)/2;
        if(minbrban<=m)res[i]=true;
    }
    for(int i=0; i<t; i++)
    {
        if(res[i])cout<<"Tak\n";
        else cout<<"Nie\n";
    }
    return 0;
}