#include <bits/stdc++.h>
using namespace std;
int a[301101];
int second[500101];
int pos[300101];
int n, m;
int solve(int n0, int p) {
  int x = 1;
  if (second[p] != -1) return second[p];
  int c = 1;
  for (int i = 1; ((p + i * n0 <= n) || (p - i * n0 >= 1)); i++) {
    if (a[p + i * n0] > n0) x = ((x) & (solve(a[p + i * n0], (p + i * n0))));
    if ((p - i * n0 > 0)) {
      if (a[p - i * n0] > n0) x = ((x) & (solve(a[p - i * n0], (p - i * n0))));
    }
  }
  second[p] = ((1) ^ (x));
  return ((1) ^ (x));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  memset(second, -1, 100100 * sizeof(second[0]));
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  for (int i = n; i >= 1; i--) {
    second[pos[i]] = solve(i, pos[i]);
  }
  for (int i = 1; i <= n; i++)
    if (second[i] == 1)
      cout << 'A';
    else
      cout << 'B';
}
