#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) void solve() { ll n; cin >> n; map pre; pre[n] = 'C'; queue que; que.push(n); while (!que.empty()) { ll y = que.front(); que.pop(); for (ll s : {2, 3}) { if ((y - 1) % s == 0) { ll x = (y - 1) / s; if (pre.count(x) == 0) { pre[x] = s == 2 ? 'A' : 'B'; que.push(x); } } } } string ans = ""; ll now = 1; while (now < n) { char c = pre[now]; ans.push_back(c); now = now * (c == 'A' ? 2 : 3) + 1; } cout << ans << '\n'; } int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); int T = 1; for (int t = 0; t < T; t++) { solve(); } return 0; }