#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,s = ""; void dfs(string s,int i){ if(i == 1){ ans = s; return; } i--; if(i%2 == 0) dfs(s+'A',i/2); if(i%3 == 0) dfs(s+'B',i/3); } int main(void){ int n; cin >> n; dfs(s,n); reverse(all(ans)); cout << ans; }