#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int MAXN = 100005;
int n, a[MAXN];
vector<int> d[MAXN];
int pos[MAXN];
int win[MAXN];
void solve() {
  for (int i = 0; i < n; i++) {
    pos[a[i]] = i;
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j += i) {
      d[i].push_back(j);
      cnt++;
    }
  }
  memset(win, 0, sizeof(win));
  for (int i = n; i >= 1; i--) {
    for (int j = 0; j < d[i].size(); j++) {
      int k = d[i][j];
      int id = pos[i] - k;
      if (id >= 0 && a[id] > i && !win[a[id]]) {
        win[i] = true;
        break;
      }
      id = pos[i] + k;
      if (id < n && a[id] > i && !win[a[id]]) {
        win[i] = true;
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    printf(win[a[i]] ? "A" : "B");
  }
  printf("\n");
}
int main() {
  while (scanf("%d", &n) == 1) {
    for (int i = 0; i < n; i++) {
      scanf("%d", a + i);
    }
    for (int i = 1; i <= n; i++) {
      d[i].clear();
    }
    solve();
  }
}
