#include <bits/stdc++.h>
using namespace std;
long long x, y;
vector<long long> ans;
bool ok = 1;
void go(long long x, long long y) {
  if (x > y) {
    if (x % y == 0 && y != 1) {
      ok = 0;
      return;
    }
    ans.push_back(x / y);
    if (y == 1) {
      ans.back()--;
    } else {
      go(x % y, y);
    }
  } else {
    if (y % x == 0 && x != 1) {
      ok = 0;
      return;
    }
    ans.push_back(y / x);
    if (x == 1) {
      ans.back()--;
    } else {
      go(x, y % x);
    }
  }
}
int main() {
  scanf("%lld%lld", &x, &y);
  go(x, y);
  if (!ok) {
    puts("Impossible");
  } else {
    if (ans.back() == 0) ans.pop_back();
    char c = x > y ? 'A' : 'B';
    for (int i = 0; i < ans.size(); ++i) {
      printf("%lld", ans[i]);
      putchar(c);
      c = 'A' + ('B' - c);
    }
    putchar('\n');
  }
  return 0;
}
