#include <bits/stdc++.h>
using namespace std;
long long a, b, num = 0;
long long gcd(long long a, long long b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
void work(long long a, long long b, char c1, char c2) {
  if (a == 1 && b == 1) return;
  if (a < b) {
    swap(a, b);
    swap(c1, c2);
  }
  if (c1 == 'A')
    printf("%I64dA", (a - 1) / b);
  else
    printf("%I64dB", (a - 1) / b);
  work(a - ((a - 1) / b) * b, b, c1, c2);
}
int main() {
  cin >> a >> b;
  if (gcd(a, b) != 1)
    puts("Impossible");
  else
    work(a, b, 'A', 'B');
  return 0;
}
