#include <iostream>

using namespace std;

int main()
{
    int hdgh;
    cin>>hdgh;
    for (int i=0; i<hdgh; i++){
        int n;
        int m;
        int k;
        cin>>n>>m>>k;
        int a=n/k;
        int w=n%k;
        int b = ((a*(a+1))/2)*k + (a+1)*w;
        if (b>m || n>k){cout<<"Nie"<<endl;}
        else{cout<<"Tak"<<endl;}
    }
    return 0;
}