import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np Q = int(readline()) DXT = np.fromstring(read(), np.int64, sep=' ') D = DXT[::3] X = DXT[1::3] T = DXT[2::3] U = 3100 INF = 10 ** 16 comb = np.zeros((U,U),np.int64) comb[0,0] = 1 for n in range(1,U): comb[n,:n] += comb[n-1,:n] comb[n,1:n+1] += comb[n-1,:n] np.minimum(INF, comb[n], out=comb[n]) answer = np.where(comb[X+D-1,D-1] <= T, 'AC', 'ZETUBOU') print('\n'.join(answer))