#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int INF = (1 << 30) - 1;
long long Gcd(long long a, long long b) {
  while (a > 0 && b > 0) {
    if (a > b)
      a %= b;
    else
      b %= a;
  }
  return a + b;
}
long long x, y;
int main() {
  cin >> x >> y;
  if (Gcd(x, y) != 1) {
    printf("Impossible\n");
    return 0;
  }
  vector<char> ans;
  while (x > 0 && y > 0) {
    if (x > y) {
      long long k = x / y;
      x %= y;
      if (x == 0) k--;
      vector<char> g;
      while (k) {
        g.push_back(k % 10 + '0');
        k /= 10;
      }
      for (int i = g.size() - 1; i >= 0; --i) ans.push_back(g[i]);
      ans.push_back('A');
    } else {
      long long k = y / x;
      y %= x;
      if (y == 0) k--;
      vector<char> g;
      while (k) {
        g.push_back(k % 10 + '0');
        k /= 10;
      }
      for (int i = g.size() - 1; i >= 0; --i) ans.push_back(g[i]);
      ans.push_back('B');
    }
  }
  for (int i = 0; i < ans.size(); ++i) printf("%c", ans[i]);
  puts("");
  return 0;
}
