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