#include <bits/stdc++.h>
const double PI = atan(1) * 4;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> pos(n + 1, 0), arr(n);
  for (int i = 0; i < n; i++) {
    int h;
    cin >> h;
    pos[h] = i;
    arr[i] = h;
  }
  vector<int> ans(n + 1, -1);
  for (int i = n; i > 0; i--) {
    int x = pos[i];
    int x_ = x + i;
    bool state = 0;
    int newpos = x + i;
    while (newpos <= n && !state) {
      if (ans[newpos] == 0 && arr[newpos] > i) {
        state = 1;
      }
      newpos += i;
    }
    newpos = x - i;
    while (newpos >= 0 && !state) {
      if (ans[newpos] == 0 && arr[newpos] > i) {
        state = 1;
      }
      newpos -= i;
    }
    ans[x] = state;
  }
  for (int i = 0; i < n; i++) {
    cout << (ans[i] ? "A" : "B");
  }
  return 0;
}
