#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    long long t,n,m,k,rez;
    cin>>t;
    for(int i=0;i<t;i++)
    {
        cin>>n>>m>>k;
        long long brojac=n/k,raz=n%k;
            rez=raz*((brojac+1)*(brojac+2))/2+(n-raz)*((brojac)*(brojac+1));
            if(rez>m)
                printf("Nie\n");
            else printf("Tak\n");
    }

    return 0;
}