#include <bits/stdc++.h>
int faster_in() {
  int r = 0, c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') return -faster_in();
  for (; c > 32; r = (r << 1) + (r << 3) + c - '0', c = getchar())
    ;
  return r;
}
using namespace std;
const int INF = int(1e9 + 7);
int v[100010], pos[100010];
bool win[100010];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    pos[v[i]] = i;
  }
  memset(win, (false), sizeof(win));
  for (int i = n - 1; i >= 1; i--) {
    bool winFlg = false;
    for (int j = pos[i] + i; j < n; j += i) {
      if (v[j] < i) continue;
      if (win[v[j]] == false) win[i] = true;
    }
    for (int j = pos[i] - i; j >= 0; j -= i) {
      if (v[j] < i) continue;
      if (win[v[j]] == false) win[i] = true;
    }
  }
  for (int i = 0; i < n; i++) {
    if (win[v[i]])
      cout << 'A';
    else
      cout << 'B';
  }
  cout << '\n';
  return 0;
}
