#include <bits/stdc++.h>
std::deque<long long> Q;
long long int gcd(long long int a, long long b) {
  while (a != b) {
    if (a >= b) {
      Q.push_back((a - 1LL) / b);
      a -= (a - 1LL) / b * b;
    } else {
      Q.push_back(-(b - 1LL) / a);
      b -= (b - 1LL) / a * a;
    }
  }
  return a;
}
int main() {
  long long a, b;
  scanf("%I64d%I64d", &a, &b);
  if (gcd(a, b) == 1) {
    for (const auto &it : Q) {
      printf("%I64d", std::abs(it));
      if (it > 0)
        printf("A");
      else
        printf("B");
    }
  } else {
    puts("Impossible");
  }
  return 0;
}
