#include <iostream>

using namespace std;

int main()
{
    int t;
    cin>>t;
    for(int i =0;i<t;i++){
        int n,m,k;
        cin>>n>>m>>k;
        int b=n/k;
        int o=n%k;
        int d=(k-o)*(b+1)*b/2+o*(b+2)*(b+1)/2;
        if(d<=m){
            cout<<"Tak";
        }
        else{
            cout<<"Nie";
        }
    }
    return 0;
}