#include <iostream>

using namespace std;

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

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