#include <bits/stdc++.h>
using namespace std;
long long x, y;
bool sol;
vector<long long> turn;
void gcd(long long x, long long y) {
  if (y == 1) {
    turn.push_back(x - 1);
    sol = 1;
    return;
  }
  if (y == 0) return;
  turn.push_back(x / y);
  gcd(y, x % y);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> x >> y;
  gcd(x, y);
  if (!sol) {
    cout << "Impossible";
    return 0;
  }
  for (long long i = 0; i < turn.size(); i++) {
    if (turn[i] == 0) continue;
    cout << turn[i];
    if (i & 1)
      cout << 'B';
    else
      cout << 'A';
  }
}
