#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n, 0), b(n, -1);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> pos(n, -1);
  for (int i = 0; i < n; i++) pos[a[i] - 1] = i;
  int cur = n;
  while (cur > 0) {
    int x = pos[cur - 1];
    bool win = false;
    for (int i = x; i < n; i += cur)
      if (b[i] == 0) win = true;
    for (int i = x; i >= 0; i -= cur)
      if (b[i] == 0) win = true;
    b[x] = win ? 1 : 0;
    cur--;
  }
  for (int i = 0; i < n; i++) cout << (b[i] == 1 ? 'A' : 'B');
  cout << endl;
}
