#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
template <typename T, typename U>
pair<T, U> operator+(const pair<T, U> &l, const pair<T, U> &r) {
  return make_pair(l.first + r.first, l.second + r.second);
}
template <typename T, typename U>
pair<T, U> operator*(const pair<T, U> &l, const long long &r) {
  return make_pair(l.first * r, l.second * r);
}
long long x, y;
long long a, b;
vector<pair<long long, long long> > ans;
int flag = 0;
long long gcd(long long x, long long y) { return x == 0 ? y : gcd(y % x, x); }
void rgcd(long long x, long long y) {
  if (x == 0 || y == 0) {
    if (x == 0)
      a = 1, flag = 1;
    else
      b = 1;
    return;
  }
  if (x > y) {
    long long q = x / y;
    x -= y * q;
    rgcd(x, y);
    a += b * q;
  } else {
    long long q = y / x;
    y -= x * q;
    rgcd(x, y);
    b += a * q;
  }
}
long long rdiv(long long x, long long y) {
  if (y == 0) return ((1ll << 62) - 1);
  return x / y;
}
void calc(pair<long long, long long> x, pair<long long, long long> y) {
  if (x == pair<long long, long long>(0, 1) &&
          y == pair<long long, long long>(1, 0) ||
      x == pair<long long, long long>(1, 0) &&
          y == pair<long long, long long>(0, 1)) {
    return;
  }
  if (x > y) {
    long long q = min(rdiv(x.first, y.first), rdiv(x.second, y.second));
    x = x + y * (-q);
    ans.push_back(pair<long long, long long>(q, 0));
    calc(x, y);
  } else {
    long long q = min(rdiv(y.first, x.first), rdiv(y.second, x.second));
    y = y + x * (-q);
    ans.push_back(pair<long long, long long>(q, 1));
    calc(x, y);
  }
}
int main() {
  int i, j, k;
  cin >> x >> y;
  long long rx = x, ry = y;
  if (gcd(x, y) != 1) return !printf("Impossible");
  rgcd(x, y);
  x -= a, y -= b;
  calc(pair<long long, long long>(x, y), pair<long long, long long>(a, b));
  pair<long long, long long> u = pair<long long, long long>(1, 0),
                             v = pair<long long, long long>(0, 1);
  for (i = ans.size() - 1; i >= 0; i--) {
    pair<long long, long long> now = ans[i];
    if (now.second == 0)
      v = v + u * now.first;
    else
      u = u + v * now.first;
  }
  if (u + v == pair<long long, long long>(rx, ry))
    flag = 0;
  else
    flag = 1;
  for (i = ans.size() - 1; i >= 0; i--) {
    printf("%lld", ans[i].first);
    printf(ans[i].second == flag ? "A" : "B");
  }
  return 0;
}
