#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int N;
  cin >> N;
  vector<int> A(N, 0);
  vector<int> Ai(N + 1, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    Ai[A[i]] = i;
  }
  vector<char> winner(N, ' ');
  for (int i = 0; i < N; i++) {
    int a = N - i;
    int index = Ai[a];
    bool win = false;
    for (int j = index % a; j < N; j += a) {
      if (j == index) continue;
      if (A[j] > a && winner[j] == 'B') {
        win = true;
        break;
      }
    }
    if (!win)
      winner[index] = 'B';
    else
      winner[index] = 'A';
  }
  for (int i = 0; i < N; i++) cout << winner[i];
  cout << endl;
  return 0;
}
