#include<bits/stdc++.h>
using namespace std;
void f(long long N, string &S) {
  if (N == 1) {
    reverse(S.begin(), S.end());
    cout << S << endl;
    exit(0);
  }
  N--;
  if (N % 2 == 0) {
    S.push_back('A');
    f(N / 2, S);
    S.pop_back();
  }
  if (N % 3 == 0) {
    S.push_back('B');
    f(N / 3, S);
    S.pop_back();
  }
}
int main() {
  long long N;
  cin >> N;
  string S;
  f(N, S);
}