#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * f;
}
long long x, y, q[3009];
int tot;
bool g;
int main() {
  scanf("%lld%lld", &x, &y);
  g = (x > y);
  while (x && y) {
    if (x < y)
      q[++tot] = y / x, y %= x;
    else if (x > y)
      q[++tot] = x / y, x %= y;
    else
      break;
  }
  if (x == 1 || y == 1) {
    q[tot]--;
    for (int i = 1; i <= tot; i++)
      if (q[i]) printf("%lld%c", q[i], (i % 2 != g) ? 'B' : 'A');
    puts("");
  } else
    puts("Impossible");
  return 0;
}
