#include <bits/stdc++.h>
void read();
const int N = 1e5 + 100;
const int M = 2e5 + 100;
const long long oo = 1e18;
using namespace std;
int main() {
  int n;
  cin >> n;
  int pos[N] = {};
  int ans[N] = {};
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &(v[i]));
    ;
    pos[v[i]] = i;
  }
  for (int x, i = n; i > 0; i--) {
    x = pos[i];
    bool fu = false;
    for (int j = x; j >= 0; j -= i) {
      if (v[j] > i) {
        if (ans[v[j]] % 2 == 0) {
          ans[i] = 1;
          fu = true;
          break;
        } else
          ans[i] += 1 + ans[v[j]];
      }
    }
    for (int j = x; j < n && !fu; j += i) {
      if (v[j] > i) {
        if (ans[v[j]] % 2 == 0) {
          ans[i] = 1;
          fu = true;
          break;
        } else
          ans[i] += 1 + ans[v[j]];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (ans[v[i]] % 2)
      cout << 'A';
    else
      cout << 'B';
  }
  return 0;
}
void read() {
  freopen("in.txt", "r", stdin);
  freopen("ou.txt", "w", stdout);
}
