N = int(input()) gr = [-1]*(N+1) gr[1] = 0 for i in range(2, N+1): S = {gr[i//2] ^ gr[i-i//2]} if i > 2: if i % 3 == 1: S.add(gr[i//3+1]) else: S.add(gr[i//3]) for j in range(3): if j not in S: gr[i] = j break print('A' if gr[N] else 'B')