#include <bits/stdc++.h>
using namespace std;
struct OP {
  long long number;
  char ch;
  OP() {}
  OP(long long _number, char _ch) : number(_number), ch(_ch) {}
};
vector<OP> ans;
bool flag = false;
void sol(long long first, long long second) {
  if (first == 1 && !second) {
    flag = true;
    return;
  }
  if (second == 1 && !first) {
    flag = true;
    return;
  }
  if (!first || !second) {
    flag = false;
    return;
  }
  if (first > second) {
    long long tmp = first / second;
    if (!(first % second)) tmp--;
    ans.push_back(OP(tmp, 'A'));
    sol(first % second, second);
  } else {
    long long tmp = second / first;
    if (!(second % first)) tmp--;
    ans.push_back(OP(tmp, 'B'));
    sol(first, second % first);
  }
}
int main() {
  long long first, second;
  cin >> first >> second;
  sol(first, second);
  if (!flag) {
    puts("Impossible");
    return 0;
  }
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i].number << ans[i].ch;
  }
  cout << endl;
}
