#include <bits/stdc++.h>
using namespace std;
bool prime(long long int n) {
  if (n <= 1) return false;
  for (long long int i = 2; i <= (long long int)sqrt(n); i++)
    if (n % i == 0) return false;
  return true;
}
int pos[100001], a[100001], w[100001];
int main() {
  int n, i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    pos[a[i]] = i;
  }
  memset(w, -1, sizeof(w));
  int j;
  for (i = (int)sqrt(n); i <= n; i++) {
    int f = 0;
    for (j = pos[i] + i; j <= n; j += i) {
      if (a[j] > i) {
        f = 1;
        break;
      }
    }
    if (!f) {
      for (j = pos[i] - i; j >= 1; j -= i) {
        if (a[j] > i) {
          f = 1;
          break;
        }
      }
    }
    if (f == 0)
      w[i] = 0;
    else
      w[i] = -1;
  }
  for (i = n; i >= 1; i--) {
    if (w[i] != -1) continue;
    int f = 0, f2 = 1;
    for (j = pos[i] + i; j <= n; j += i) {
      if (a[j] < i) continue;
      if (w[a[j]] != 1) f2 = 0;
      if (w[a[j]] == 0) {
        w[i] = 1;
        f = 1;
        break;
      }
    }
    if (f) continue;
    for (j = pos[i] - i; j >= 1; j -= i) {
      if (a[j] < i) continue;
      if (w[a[j]] != 1) f2 = 0;
      if (w[a[j]] == 0) {
        w[i] = 1;
        f = 1;
        break;
      }
    }
    if (f2) w[i] = 0;
  }
  char ans[n + 2];
  for (i = 1; i <= n; i++) {
    ans[pos[i]] = 'A' + (1 - w[i]);
  }
  for (i = 1; i <= n; i++) printf("%c", ans[i]);
  return 0;
}
