#include <bits/stdc++.h>
using namespace std;
int main() {
  long long A, B;
  cin >> A >> B;
  char C[2] = {'A', 'B'};
  if (B > A) {
    swap(A, B);
    swap(C[0], C[1]);
  }
  long long a = A;
  long long b = B;
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  if (a != 1) {
    cout << "Impossible\n";
    return 0;
  }
  bool i = false;
  while (B != 0) {
    long long d = A / B;
    if (B == 1) d = A - 1;
    cout << d << C[i];
    A %= B;
    swap(A, B);
    i = !i;
  }
  cout << endl;
}
