#include <bits/stdc++.h>
using namespace std;
long long x, y;
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
void gcd(long long x, long long y, char a, char b) {
  long long ox, oy;
  while (!(x == 1 && y == 1)) {
    if (x < y) {
      swap(x, y);
      swap(a, b);
    }
    printf("%I64d%c", (x - 1) / y, a);
    ox = x, oy = y;
    x = ox - (ox - 1) / oy * oy;
    y = oy;
  }
}
int main() {
  scanf("%I64d %I64d", &x, &y);
  if (gcd(x, y) != 1)
    return puts("Impossible"), 0;
  else {
    gcd(x, y, 'A', 'B');
  }
  return 0;
}
