#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b) {
  long long int res = 1;
  a = a % 1000000007;
  while (b > 0) {
    if (b & 1) {
      res = (res * a) % 1000000007;
      b--;
    }
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  vector<long long int> pos(n + 1);
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
    pos[v[i]] = i + 1;
  }
  vector<long long int> ans(n + 1, 0);
  vector<char> c(n);
  for (long long int i = n; i >= 1; i--) {
    long long int bo = 0;
    for (long long int j = i; j <= n; j += i) {
      if (pos[i] - j > 0 && v[pos[i] - j - 1] > i) bo |= !ans[pos[i] - j];
      if (pos[i] + j <= n && v[pos[i] + j - 1] > i) bo |= !ans[pos[i] + j];
    }
    ans[pos[i]] = bo;
  }
  for (long long int i = 0; i < n; i++) {
    long long int cur = ans[pos[v[i]]];
    if (cur == 1)
      cout << "A";
    else
      cout << "B";
  }
}
