import sys read=sys.stdin.buffer.read readline=sys.stdin.buffer.readline readlines=sys.stdin.buffer.readlines n=int(readline()) dp=[0]*(n+1) for i in range(2, n+1): st=set() if i%2==0: st.add(0) else: st.add(dp[i//2]^dp[i//2+1]) if i%3==0 or i%3==2: st.add(dp[i//3]) else: st.add(dp[i//3+1]) for x in range(3): if x not in st: dp[i]=x break if dp[n]: print('A') else: print('B')