#include <bits/stdc++.h>
using namespace std;
bool startwins[100005];
bool was[100005];
int arr[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<pair<int, int> > vals(n);
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    vals[i - 1] = {arr[i], i};
  }
  sort(vals.begin(), vals.end());
  startwins[vals[n - 1].second] = false;
  was[vals[n - 1].second] = true;
  for (int i = n - 2; i >= 0; i--) {
    int pos = vals[i].second;
    int val = vals[i].first;
    bool wn = false;
    for (int j = 1; j * i <= n; j++) {
      if (pos - j * val >= 1 && was[pos - j * val]) {
        if (!startwins[pos - j * val]) {
          wn = true;
          break;
        }
      }
      if (pos + j * val <= n && was[pos + j * val]) {
        if (!startwins[pos + j * val]) {
          wn = true;
          break;
        }
      }
    }
    was[pos] = true;
    if (wn) {
      startwins[pos] = true;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << (startwins[i] ? 'A' : 'B');
  }
  return 0;
}
