#include <iostream>

using namespace std;

bool moguce(int n, long long m, int k){
    int a = n / k;
    int b = n % k;
    int c = 1;
    long long d = 0;
    for (int j = 0; j < a; j++){
        d = d + c;
        c++;
    }
    d = d * k;
    d = d + b * c;
    if (m < d) return false;
    return true;
}

int main()
{
    int t;
    cin >> t;
    for (int i = 0; i < t; i++){
        int n, k;
        long long m;
        cin >> n >> m >> k;
        if(moguce(n, m, k)) cout << "Tak" << endl;
        else cout << "Nie" << endl;
    }
	return 0;
}