#include using namespace std; template inline T gcd(T a, T b) { return __gcd(a, b); } template inline T lcm(T a, T b) { return a / gcd(a, b) * b; } template inline T floor(T a, T b) { return a / b * b <= a ? a / b : a / b - 1; } template inline T ceil(T a, T b) { return floor(a + b - 1, b); } template inline T round(T a, T b) { return floor(a + b / 2); } template inline T mod(T a, T b) { return a - floor(a, b) * b; } template inline T factorial(T n) { return n <= 1 ? 1 : factorial(n - 1) * n; } template class Combination { private: vector> comb; public: Combination(int n = 0) : comb(n, vector(n, 0)) { for (int i = 0; i < n; ++i) comb[i][0] = 1; for (int i = 1; i < n; ++i) { for (int j = 1; j < n; ++j) { comb[i][j] = comb[i - 1][j] + comb[i - 1][j - 1]; } } } T combination(int n, int m) { if (n < m) return 0; if (n < (int)comb.size()) return comb[n][m]; T res = 1; for (int i = 0; i < min(m, n - m); ++i) res = res * (n - i) / (i + 1); return res; } T combination_safety(int n, int m) { if (n < m) return 0; if (n < (int)comb.size()) return comb[n][m]; m = min(m, n - m); vector a(m), b(m); iota(a.begin(), a.end(), n - m + 1); iota(b.begin(), b.end(), 1); for (auto i : b) { for (auto& j : a) { auto g = gcd(i, j); i /= g; j /= g; if (i == 1) break; } } T res = 1; for (auto i : a) res = res * i; return res; } T repetition(int n, int r) { return combination(n + r - 1, r); } }; int main() { int q; cin >> q; Combination comb; for (int i = 0; i < q; ++i) { long long d, x, t; cin >> d >> x >> t; if (t == 0) { cout << "ZETUBOU" << endl; continue; } double sum = 0, limit = log(t); for (int i = x + 1; i <= d + x - 1; ++i) sum += log(i + 1); if (sum > limit * 2) { cout << "ZETUBOU" << endl; continue; } int s = comb.combination(d + x - 1, x); cout << (s <= t ? "AC" : "ZETUBOU") << endl; } }