#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int64_t x;
  cin >> x;
  ;
  int64_t y;
  cin >> y;
  ;
  char alice = 'A', bob = 'B';
  if (x < y) {
    std::swap(x, y);
    std::swap(alice, bob);
  }
  vector<int64_t> a;
  while (y) {
    a.push_back(x / y);
    int64_t oldY = y;
    y = x - a.back() * y;
    x = oldY;
  }
  if (x != 1) {
    cout << "Impossible";
    return 0;
  }
  --a.back();
  if (!a.back()) a.pop_back();
  for (int i = 0; i < a.size(); ++i) {
    cout << a[i] << alice;
    std::swap(alice, bob);
  }
  return 0;
}
