#include <bits/stdc++.h>
using namespace std;
const long long INF = 1 << 28;
const long long LINF = 1ll << 61;
inline long long getnum() {
  register long long r = 0;
  register bool ng = 0;
  register char c;
  c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  if (c == '-') ng = 1, c = getchar();
  while (c != ' ' && c != '\n') r = r * 10 + c - '0', c = getchar();
  if (ng) r = -r;
  return r;
}
template <class T>
inline void putnum(T x) {
  if (x < 0) putchar('-'), x = -x;
  register short a[20] = {}, sz = 0;
  while (x > 0) a[sz++] = x % 10, x /= 10;
  if (sz == 0) putchar('0');
  for (int i = sz - 1; i >= 0; i--) putchar('0' + a[i]);
}
inline void putsp() { putchar(' '); }
inline void putendl() { putchar('\n'); }
inline char mygetchar() {
  register char c = getchar();
  while (c == ' ' || c == '\n') c = getchar();
  return c;
}
vector<pair<long long, long long> > ans;
bool gcd(long long x, long long y) {
  if (x == 1 || y == 1) {
    if (x == 1) {
      ans.push_back(make_pair(y - 1, 2));
    } else {
      ans.push_back(make_pair(x - 1, 1));
    }
    return true;
  } else if (x == 0 || y == 0)
    return false;
  if (x > y) {
    ans.push_back(make_pair(x / y, 1));
    return gcd(x % y, y);
  } else {
    ans.push_back(make_pair(y / x, 2));
    return gcd(x, y % x);
  }
}
int main() {
  long long a, b;
  cin >> a >> b;
  ans.clear();
  if (gcd(a, b)) {
    for (int i = 0; i < ans.size(); i++) {
      if (ans[i].second == 1) {
        cout << ans[i].first << "A";
      } else {
        cout << ans[i].first << "B";
      }
    }
  } else {
    puts("Impossible");
  }
  return 0;
}
