#include #include #define rep(i,n) for(int i = 0; i < n; i++) #define rrep(i,a,b) for(int i = a; i < b; i++) #define all(A) (A).begin(),(A).end() #define MOD 1000000007 #define grt greater() #define mapf(M) for(auto& [k,v] : M) using namespace std; using ll = long long; using P = pair; using pq = priority_queue,greater>; ll INF = 1LL<<60; template bool chmax(T &a,T &b){ if(a < b){ a = b; return true; } return false; } template bool chmin(T &a,T &b){ if(a > b){ a = b; return true; } return false; } struct Edge { int to; int cost; int from; }; using Graph = vector>; using vi = vector; string ans; void dfs(string s,int x){ if(x == 1) return; x--; if(x%2 == 0){ s.push_back('A'); dfs(s,x/2); if(x/2 == 1) ans = s; s.pop_back(); } if(x%3 == 0){ s.push_back('B'); dfs(s,x/3); if(x/3 == 1) ans = s; s.pop_back(); } return; } int main(void){ int n; cin >> n; string s = ""; dfs(s,n); reverse(all(ans)); cout << ans; }