def determine_winner(): max_n = 100 grundy = [0] * (max_n + 1) grundy[1] = 0 # 1 stones cannot split, lose immediately for n in range(2, max_n + 1): moves = set() # Check 2-split possibilities if n % 2 == 0: x = n // 2 if x >= 1: # Split into two parts x, x g = grundy[x] ^ grundy[x] moves.add(g) else: x = (n - 1) // 2 if x >= 1: # Split into x and x+1 g = grundy[x] ^ grundy[x + 1] moves.add(g) # Check 3-split possibilities if n >= 3: # Case 3x if n % 3 == 0: x = n // 3 if x >= 1: g = grundy[x] ^ grundy[x] ^ grundy[x] moves.add(g) # Case 3x + 1 if (n - 1) % 3 == 0: x = (n - 1) // 3 if x >= 1: g = grundy[x] ^ grundy[x] ^ grundy[x + 1] moves.add(g) # Case 3x + 2 if (n - 2) % 3 == 0: x = (n - 2) // 3 if x >= 1: g = grundy[x] ^ grundy[x + 1] ^ grundy[x + 1] moves.add(g) # Calculate mex for current n mex = 0 while True: if mex not in moves: grundy[n] = mex break mex += 1 n = int(input()) return 'A' if grundy[n] != 0 else 'B' print(determine_winner())