import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); sc.close(); System.out.println(dfs(n)); } static Map map = new HashMap<>(); static String dfs(long n) { if (map.containsKey(n)) { return map.get(n); } if (n == 1) { return ""; } n--; String res = ""; if (n % 2 == 0) { res = dfs(n / 2); if (res != null) { return res + "A"; } } if (n % 3 == 0) { res = dfs(n / 3); if (res != null) { return res + "B"; } } return null; } }