#include <bits/stdc++.h>
using namespace std;
int N;
int A[100005];
int pos[100005];
int DP[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
    pos[A[i]] = i;
  }
  for (int i = N - 1; i >= 1; i--) {
    int pi = pos[i];
    for (int nx = pi + i; nx <= N; nx += i) {
      if (A[nx] > i && !DP[nx]) DP[pi] = 1;
    }
    for (int nx = pi - i; nx >= 1; nx -= i) {
      if (A[nx] > i && !DP[nx]) DP[pi] = 1;
    }
  }
  for (int i = 1; i <= N; i++) cout << (DP[i] == 1 ? "A" : "B");
  cout << '\n';
  return 0;
}
