#include <iostream>

typedef unsigned long long ull;


using namespace std;

bool solve(){
    ull n,m,k;
    cin>>n>>m>>k;
    if(n<k) return 0;

    ull need = k*(n/k)*(n/k+1)/2;
    need+=(n/k+1)*(n%k);
    return need<=m;

}


int main()
{
    int t;
    cin>>t;
    for(int l=0;l<t;l++){

        cout << ((solve()) ? "Tak" : "Nie") << endl;

    }
    return 0;
}