#include <bits/stdc++.h>
using namespace std;
const int N = 100500;
long long x, y;
long long gcd(long long a, long long b) {
  if (a == 0) {
    return b;
  }
  return gcd(b % a, a);
}
void solve(long long a, long long b, char A, char B) {
  if (a == 1 && b == 1) {
    return;
  }
  if (a < b) {
    swap(a, b);
    swap(A, B);
  }
  cout << (a - 1) / b << A;
  long long x, y;
  x = a;
  y = b;
  a = x - (x - 1) / y * y;
  b = y;
  solve(a, b, A, B);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> x >> y;
  if (gcd(x, y) != 1) {
    cout << "Impossible";
    return 0;
  }
  solve(x, y, 'A', 'B');
  return 0;
}
