#include <bits/stdc++.h>
using namespace std;
long long gcd(long long A, long long B) { return B ? gcd(B, A % B) : A; }
void print(long long A, long long B, int opt) {
  if (B == 0) return;
  printf("%lld%c", B != 1 ? A / B : A / B - 1, opt == 0 ? 'A' : 'B');
  print(B, A % B, opt ^ 1);
}
signed main() {
  long long x, y;
  scanf("%lld %lld", &x, &y);
  if (gcd(x, y) != 1) {
    printf("Impossible\n");
    return 0;
  }
  print(max(x, y), min(x, y), x == max(x, y) ? 0 : 1);
  return 0;
}
