#[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn grundy(n: usize, mem: &mut Vec) -> i32 { if mem[n] != -1 { return mem[n]; } let mut s = HashSet::new(); for i in 1..n { for j in i..n - i + 1 { let k = n - i - j; s.insert(grundy(i, mem) ^ grundy(j, mem) ^ grundy(k, mem)); } } let mut res = 0; while s.contains(&res) { res += 1; } mem[n] = res; res } fn main() { let n: usize = read(); let mut mem = vec![-1; n + 1]; mem[0] = 0; if grundy(n, &mut mem) == 0 { println!("B"); } else { println!("A"); } }