include <iostream>

using namespace std;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0);
    long int t,i,zbir = 0,j,x;
    cin >> t;
    long int arrn[t],arrm[t],arrk[t];
    for (i = 0; i < t; i++){
        cin >> arrn[i] >> arrm[i] >> arrk[i];
    }
    for (j = 0;j < t; j++){
            for (i = 1; i <= arrn[j]/arrk[j]; i++){
                zbir += arrk[j] * i;
    }
    x = arrn[j] -((arrn[j]/arrk[j]) * arrk[j]);
    if (x * i <= arrm[j] - zbir){
        cout << "Tak";
        cout << endl;
    }
    else{
        cout << "Nie";
        cout << endl;
    }
    zbir = 0;
    x = 0;
    }

    return 0;
}