#include <iostream>
#include <vector>
using namespace std;
int main()
{
    int t,n,k,u=0,j;
    unsigned long long m;
    cin>>t;
    vector<string>a(t);
    for(int i=0;i<t;i++){
     cin>>n>>m>>k;
     j=1;
   while(n>=k){
    u+=j*k;
   n-=k;
      j++;
    }
    u+=j*n;
    if(u>m)a[i]="Nie";
    else a[i]="Tak";
    }
    for(int i=0;i<t;i++)cout<<a[i]<<endl;
    return 0;
}