#include <iostream>

using namespace std;

int main()
{
    int T, N, M, K;
    cin >> T;
    int x[T][3];
    for(int i = 0; i < T; i++){
        cin >> N >> M >> K;
        x[i][0]=N;
        x[i][1]=M;
        x[i][2]=K;
    }

    for(int i = 0; i < T; i++){
        int lug = x[i][0]/x[i][2];
        int ostl = x[i][0]%x[i][2];

        int s1= 0;
        for(int j = 1; j <= lug; j++){
            s1 += j;
        }

        int s2 = 0;
        for(int k = lug + 1; k <= ostl; k++){
            s2 += k;
        }

        int sb = 0;
        sb = x[i][2]*s1+s2;
        if(sb <= x[i][1])
            cout<< "Tak" << endl;
        if(sb > x[i][1])
            cout<< "Nie" << endl;
    }

    return 0;
}