#include <bits/stdc++.h>
using namespace std;
long long x, y, ans[111111];
int res;
long long gcd(long long x, long long y) {
  if (!y) return x;
  ans[res++] = x / y;
  return gcd(y, x % y);
}
int main() {
  char a, b;
  while (~scanf("%I64d%I64d", &x, &y)) {
    a = 'A', b = 'B';
    res = 0;
    if (x < y) swap(x, y), swap(a, b);
    if (gcd(x, y) != 1)
      printf("Impossible");
    else
      for (int i = 0; i < res; i++, swap(a, b))
        printf("%I64d%c", (i == res - 1 ? ans[i] - 1 : ans[i]), a);
    printf("\n");
  }
  return 0;
}
