#include <bits/stdc++.h>
using namespace std;
int save[100005];
int id[100005];
int vis[100005];
int main() {
  int n;
  long long x, y;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> save[i];
    id[save[i]] = i;
  }
  for (int i = n; i >= 1; i--) {
    int index = id[i] % i;
    for (; index <= n; index += i) {
      if (save[index] > i && vis[index] == 2) vis[id[i]] = 1;
    }
    if (vis[id[i]] != 1) vis[id[i]] = 2;
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 1)
      cout << "A";
    else
      cout << "B";
  }
  cout << endl;
  return 0;
}
