#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
vector<int> d[maxn];
int a[maxn];
int f[maxn];
int tag[maxn];
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    f[a[i]] = i;
  }
  for (int i = n; i >= 1; i--) {
    int pos = f[i];
    for (int j = pos + i; j <= n; j += i) {
      if (i < a[j]) d[f[i]].push_back(j);
    }
    for (int j = pos - i; j >= 1; j -= i) {
      if (i < a[j]) d[f[i]].push_back(j);
    }
  }
  memset(tag, -1, sizeof(tag));
  for (int i = n; i >= 1; i--) {
    int sz = d[f[i]].size();
    if (sz == 0) {
      tag[f[i]] = 0;
    } else {
      for (int v : d[f[i]]) {
        if (tag[v] == 0) {
          tag[f[i]] = 1;
          break;
        }
      }
    }
  }
  for (int i = n; i >= 1; i--) {
    int pos = f[i];
    if (tag[pos] != -1) continue;
    bool flag = false;
    for (int v : d[pos]) {
      if (tag[v] == 0) {
        tag[pos] = 1;
        flag = true;
        break;
      }
    }
    if (flag == false) tag[pos] = 0;
  }
  for (int i = 1; i <= n; i++) {
    if (tag[i])
      printf("A");
    else
      printf("B");
  }
  printf("\n");
  return 0;
}
