#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
const int inf = 1e9 + 7;
long long gcd(long long x, long long y) {
  if (x == 0)
    return y;
  else
    return gcd(y % x, x);
}
long long x, y;
int main() {
  while (scanf("%lld%lld", &x, &y) != EOF) {
    if (gcd(x, y) > 1)
      printf("Impossible\n");
    else {
      while (x && y) {
        if (y > x) {
          if (x == 1) y--;
          printf("%I64dB", y / x);
          y %= x;
        } else {
          if (y == 1) x--;
          printf("%I64dA", x / y);
          x %= y;
        }
      }
      printf("\n");
    }
  }
  return 0;
}
