#include <bits/stdc++.h>
using namespace std;
long long x, y;
vector<long long> cnt;
vector<char> sol;
bool ok;
void solve(long long x, long long y) {
  if (!x) {
    if (y == 1) ok = 1;
    return;
  }
  if (!y) {
    if (x == 1) ok = 1;
    return;
  }
  if (x == y) {
    if (x == 1) ok = 1;
    return;
  }
  if (x > y) {
    sol.push_back('A');
    if (x % y == 0) {
      cnt.push_back(x / y - 1);
    } else {
      cnt.push_back(x / y);
    }
    solve(x % y, y);
  } else {
    sol.push_back('B');
    if (y % x == 0) {
      cnt.push_back(y / x - 1);
    } else {
      cnt.push_back(y / x);
    }
    solve(x, y % x);
  }
}
int main() {
  cin >> x >> y;
  solve(x, y);
  if (ok) {
    for (int i = 0; i < sol.size(); ++i) {
      cout << cnt[i] << sol[i];
    }
  } else {
    cout << "Impossible";
  }
  return 0;
}
