#![allow(non_snake_case, unused_imports)] use proconio::{fastout, input, marker::*}; #[fastout] fn main() { input! { mut N: usize, } let mut ans = vec![]; while N != 1 { if (N - 1) % 2 == 0 { N = (N - 1) / 2; ans.push('A'); } else { N = (N - 1) / 3; ans.push('B'); } } ans.reverse(); println!( "{}", ans.iter() .map(|x| x.to_string()) .collect::>() .join("") ); }