#include <bits/stdc++.h>
long long unsigned G(long long unsigned a, long long unsigned b) {
  return b ? G(b, a % b) : a;
}
long long lx, ly;
long long egcd(long long a, long long b) {
  long long r, q, x = 0, y = 1;
  lx = 1;
  ly = 0;
  unsigned ee = 1;
  while (b != 0) {
    q = a / b;
    r = b;
    b = a % b;
    a = r;
    r = x;
    x = lx - q * x;
    lx = r;
    r = y;
    y = ly - q * y;
    ly = r;
    if ((ee ^= 1) && (q - (b == 0)))
      printf("%I64iB", q - (b == 0));
    else if ((q - (b == 0)))
      printf("%I64iA", q - (b == 0));
  }
  return a;
}
int main() {
  long long unsigned a, b;
  unsigned i, j, k;
  scanf("%I64u%I64u", &a, &b);
  if (G(a, b) != 1) {
    printf("Impossible\n");
    return 0;
  }
  egcd(a, b);
  putchar('\n');
  return 0;
}
