#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, bool> > ans;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a, b;
  cin >> a >> b;
  bool ok = true, swapped = false;
  while (true) {
    if (a == 1 && b == 1) break;
    if (a == 1) {
      ans.push_back({b - 1, !swapped});
      break;
    }
    if (b == 1) {
      ans.push_back({a - 1, swapped});
      break;
    }
    if (a < b) swap(a, b), swapped = !swapped;
    if (a % b == 0) {
      cout << "Impossible\n";
      return 0;
    }
    if (swapped)
      ans.push_back({a / b, 1});
    else
      ans.push_back({a / b, 0});
    a %= b;
  }
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first << (char)('A' + ans[i].second);
  cout << endl;
}
