n = int(input()) if n == 1: print('B') exit() grundy = [-1]*(n+1) grundy[0] = 0 grundy[1] = 0 for i in range(2, n+1): S = set() if i%2 == 0: g = grundy[i//2]^grundy[i//2] S.add(g) else: g = grundy[(i-1)//2]^grundy[(i-1)//2+1] S.add(g) if i%3 == 0: g = grundy[i//3]^grundy[i//3]^grundy[i//3] S.add(g) elif i%3 == 1: g = grundy[(i-1)//3]^grundy[(i-1)//3]^grundy[(i-1)//3+1] S.add(g) else: g = grundy[(i-1)//3]^grundy[(i-1)//3+1]^grundy[(i-1)//3+1] S.add(g) g = 0 while True: if g not in S: break else: g += 1 grundy[i] = g #print(grundy) if grundy[n]: print('A') else: print8('B')