#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(ll x,int n,string s){ if(x >= n){ if(x == n) ans = s; return; } if(x*2+1 <= n) dfs(x*2+1,n,s+'A'); if(x*3+1 <= n) dfs(x*3+1,n,s+'B'); } int main(void){ int n; cin >> n; string s = ""; dfs(1,n,s); cout << ans << endl; }