#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, i, j, k, x, p;
  cin >> n;
  vector<int> a(n + 1), pos(n + 1);
  vector<int> win(n + 1);
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  for (i = n; i >= 1; i--) {
    bool solved = false;
    p = pos[i];
    for (j = p + a[p]; j <= n; j += a[p]) {
      if (a[j] > a[p]) {
        if (!win[j]) {
          solved = true;
          win[p] = true;
          break;
        }
      }
    }
    if (!solved)
      for (j = p - a[p]; j >= 1; j -= a[p]) {
        if (a[j] > a[p]) {
          if (!win[j]) {
            solved = true;
            win[p] = true;
            break;
          }
        }
      }
    if (!solved) win[p] = false;
  }
  for (i = 1; i <= n; i++) {
    if (win[i])
      cout << "A";
    else
      cout << "B";
  }
  cout << "\n";
  return 0;
}
