#include <bits/stdc++.h>
using namespace std;
const long long nInf = -1000000000;
const long long pInf = 1000000000;
const long long mod = 1000000007;
const int MAXN = 1000;
void getdata();
void preproc();
void solve();
string res;
long long gcd(long long a, long long b) {
  string help = "";
  string help1 = "";
  while (a && b) {
    if (a > b) {
      help = "";
      help1 = "";
      {
        long long t = a / b - (a % b == 0);
        while (t > 0) {
          help += (t % 10 + '0');
          t /= 10;
        }
        int n = help.length();
        for (int i = 0; i < n; i++) {
          help1 += help[n - i - 1];
        }
        reverse(help.begin(), help.end());
      }
      res += help;
      res += "A";
      a = a % b;
    } else {
      help = "";
      help1 = "";
      {
        long long t = b / a - (b % a == 0);
        while (t > 0) {
          help += (t % 10 + '0');
          t /= 10;
        }
        reverse(help.begin(), help.end());
      }
      res += help;
      res += "B";
      b = b % a;
    }
  }
  return a + b;
}
long long x, y;
int main() {
  int t = 1;
  for (int i = 0; i < t; i++) {
    getdata();
    preproc();
    solve();
  }
  return 0;
}
void getdata() { scanf("%I64d %I64d", &x, &y); }
void preproc() {}
void solve() {
  if (gcd(x, y) != 1) {
    printf("Impossible\n");
    return;
  }
  cout << res;
}
