#include <bits/stdc++.h>
using namespace std;
long long x, y;
vector<long long> dapan;
long long gcd(long long x, long long y) {
  if (x == y) return x;
  if (x > y) {
    if (x % y == 0)
      dapan.push_back(x / y - 1);
    else
      dapan.push_back(x / y);
    return gcd(x - dapan.back() * y, y);
  } else {
    if (y % x == 0)
      dapan.push_back(-y / x + 1);
    else
      dapan.push_back(-y / x);
    return gcd(x, y + dapan.back() * x);
  }
}
int main() {
  cin >> x >> y;
  if (gcd(x, y) != 1) {
    cout << "Impossible";
    return 0;
  }
  for (long long v : dapan) {
    if (v < 0)
      cout << abs(v) << "B";
    else
      cout << abs(v) << "A";
  }
}
