#include <bits/stdc++.h>
using namespace std;
long long x, y;
vector<pair<long long, char> > V;
long long gcd(long long x, long long y) { return x ? gcd(y % x, x) : y; }
void solveGCD(long long x, long long y, char a, char b) {
  if (x == 1) {
    if (y > 1) V.push_back(pair<long long, char>(y - 1, b));
    return;
  }
  if (x < y) V.push_back(pair<long long, char>(y / x, b));
  solveGCD(y % x, x, b, a);
}
int main() {
  scanf("%I64d %I64d", &x, &y);
  if (gcd(x, y) != 1)
    printf("Impossible\n");
  else {
    solveGCD(x, y, 'A', 'B');
    for (int i = 0; i < V.size(); i++)
      printf("%I64d%c", V[i].first, V[i].second);
    printf("\n");
  }
}
