def combination(n, r): res = 1 t = r - 1 while t >= 0: res = res * (n - t) // (r - t) t -= 1 return res q=int(input()) for _ in range(q): d,x,t=map(int, input().split()) program = combination(d+x-1,d-1) print(program) if program > t: print('ZETUBOU') else: print('AC')