#include <bits/stdc++.h>
using namespace std;
unsigned long long X, Y;
stack<unsigned long long> K;
stack<char> Q;
bool solve(unsigned long long x, unsigned long long y) {
  if (x == 0 || y == 0) return false;
  if (x == 1 && y == 1) return true;
  if (x == 1) {
    Q.push('B');
    K.push(y - 1);
    return true;
  }
  if (y == 1) {
    Q.push('A');
    K.push(x - 1);
    return true;
  }
  if (x > y) {
    if (solve(x % y, y)) {
      Q.push('A');
      K.push(x / y);
      return true;
    }
  } else {
    if (solve(x, y % x)) {
      Q.push('B');
      K.push(y / x);
      return true;
    }
  }
  return false;
}
int main() {
  cin >> X >> Y;
  if (solve(X, Y)) {
    while (Q.size()) {
      cout << K.top() << Q.top();
      K.pop();
      Q.pop();
    }
    cout << endl;
  } else
    cout << "Impossible" << endl;
  return 0;
}
