use std::collections::HashSet; use proconio::input; fn main() { // let mut stdin = LineSource::new(BufReader::new(io::stdin())); // macro_rules! input(($($tt:tt)*) => (proconio::input!(from &mut stdin, $($tt)*))); input! { n:usize, } let ans = f(n, &mut vec![None; 101]); println!("{}", if ans != 0 { "A" } else { "B" }); } fn f(x: usize, memo: &mut [Option]) -> usize { if let Some(v) = memo[x] { return v; } let mut set = HashSet::new(); if x % 2 == 0 && x >= 2 { set.insert(f(x / 2, memo) ^ f(x / 2, memo)); } if x % 2 == 1 && x >= 3 { set.insert(f(x / 2, memo) ^ f(x / 2 + 1, memo)); } if x % 3 == 0 && x >= 3 { set.insert(f(x / 3, memo) ^ f(x / 3, memo) ^ f(x / 3, memo)); } if x % 3 == 1 && x >= 4 { set.insert(f(x / 3, memo) ^ f(x / 3, memo) ^ f(x / 3 + 1, memo)); } if x % 3 == 2 && x >= 5 { set.insert(f(x / 3, memo) ^ f(x / 3 + 1, memo) ^ f(x / 3 + 1, memo)); } let mut res = 0; while set.contains(&res) { res += 1; } memo[x] = Some(res); res }