#include <bits/stdc++.h>
using namespace std;
const int MAXN = 112345;
bool r[MAXN];
int v[MAXN];
pair<int, int> pos[MAXN];
int main() {
  memset(r, false, sizeof r);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    scanf("%d", v + i);
    pos[i] = make_pair(v[i], i);
  }
  sort(pos, pos + n);
  reverse(pos, pos + n);
  for (int i = 0; i < n; ++i) {
    int p = pos[i].second;
    int x = pos[i].first;
    for (int i = p + x; i < n; i += x) {
      if (v[i] > x && !r[i]) r[p] = true;
    }
    for (int i = p - x; i >= 0; i -= x) {
      if (v[i] > x && !r[i]) r[p] = true;
    }
  }
  for (int i = 0; i < n; ++i) {
    if (!r[i])
      printf("B");
    else
      printf("A");
  }
  cout << endl;
  return 0;
}
