N = 2*10**3
C = [[0]*(N+1) for i in range(N+1)] #C[n][k] > nCk

for i in range(N+1):
    for j in range(i+1):
        if j == 0 or j == i:
            C[i][j] = 1
        else:
            C[i][j] = C[i-1][j-1]+C[i-1][j]

def cmb3(n, k):
    return C[n][k]

q = int(input())
for i in range(q):
    d, x, t = map(int, input().split())
    c = cmb3(x+d-1, d-1)
    if c > t:
        print('ZETUBO')
    else:
        print('AC')