#include <iostream>

using namespace std;

void resi(){
long long int n,m,k,zk,nsak,grupe;
    cin >> n >> m >> k;
    nsak = n/k;
    zk = n%k;
    grupe = ((nsak * (nsak+1) )/ 2 )* (k);
    grupe += zk * (nsak+1);
    if(grupe > m){
        cout << "Nie" << endl;
    }else{
        cout << "Tak" << endl;
    }
    }

int main()
{
    int t;
    cin >> t;
    while(t){
        resi();
        t--;
    }
    return 0;
}