#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int n;
int a[MAXN];
int ans[MAXN];
int pos[MAXN];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int ii = 1; ii <= n; ii++) {
    cin >> a[ii];
    pos[a[ii]] = ii;
  }
  ans[n] = 0;
  for (int ii = n - 1; ii >= 1; ii--) {
    for (int kk = 1; pos[ii] + kk * ii <= n; kk++) {
      int t = pos[ii] + kk * ii;
      if (a[t] > ii)
        if (ans[a[t]] == 0) {
          ans[ii] = 1;
          break;
        }
    }
    for (int kk = 1; pos[ii] - kk * ii >= 1; kk++) {
      int t = pos[ii] - kk * ii;
      if (a[t] > ii)
        if (ans[a[t]] == 0) {
          ans[ii] = 1;
          break;
        }
    }
  }
  for (int ii = 1; ii <= n; ii++) {
    int num = a[ii];
    if (ans[num])
      cout << 'A';
    else
      cout << 'B';
  }
}
