#include #include using namespace std; const long long MAX_T = 1000000000000000LL; long long cache[1501][1501]; long long patterns(int x, int d) { if (d == 1) { return 1; } if (cache[x][d] >= 0) { return cache[x][d]; } long long result = 0; for (int i = 0; i <= x; ++i) { result += patterns(x - i, d - 1); if (result > MAX_T) { result = MAX_T + 1; break; } } cache[x][d] = result; return result; } int main() { fill(&cache[0][0], &cache[1500][1500] + 1, -1); int q; cin >> q; for (int i = 0; i < q; ++i) { int d, x; long long t; cin >> d >> x >> t; long long p = patterns(x, d); cout << (p <= t ? "AC" : "ZETUBOU") << endl; } return 0; }