#include <bits/stdc++.h>
using namespace std;
int ind[100005], a[100005], ans[100005];
int main() {
  ios_base::sync_with_stdio(false);
  int n, i, j, act;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    ind[a[i]] = i;
  }
  memset(ans, -1, sizeof(ans));
  for (i = n; i >= 1; i--) {
    act = ind[i];
    ans[act] = 0;
    for (j = act - i; j >= 1; j -= i)
      if (ans[j] == 0) {
        ans[act] = 1;
        break;
      }
    if (ans[act] == 0)
      for (j = act + i; j <= n; j += i)
        if (ans[j] == 0) {
          ans[act] = 1;
          break;
        }
  }
  for (i = 1; i <= n; i++)
    if (ans[i] == 0)
      cout << "B";
    else
      cout << "A";
  cout << '\n';
  return 0;
}
