#include <bits/stdc++.h>
using namespace std;
bool f[100005];
int a[100005], b[100005];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), b[a[i]] = i;
  f[b[n]] = 1;
  for (int i = n - 1; i >= 1; i--) {
    int r = b[i];
    f[r] = 1;
    for (int j = r + i; j <= n; j += i)
      if (a[j] > i) f[r] = min(f[r], !f[j]);
    for (int j = r - i; j > 0; j -= i)
      if (a[j] > i) f[r] = min(f[r], !f[j]);
  }
  for (int i = 1; i <= n; i++) {
    if (f[i] == 0)
      printf("A");
    else
      printf("B");
  }
  cout << endl;
  return 0;
}
