#[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 read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() } fn grundy(n: usize, mem: &mut Vec) -> i32 { if mem[n] != -1 { return mem[n]; } let mut s = HashSet::new(); for i in 0..n { for j in 1..n - i { 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]; if grundy(n, &mut mem) == 0 { println!("B"); } else { println!("A"); } }