#include <bits/stdc++.h>
using namespace std;
const long long mod = (long long)1e9 + 7;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
int extend_gcd(int a, int b, int& x, int& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  int x1, y1;
  int d = extend_gcd(b, a % b, x1, y1);
  x = y1;
  y = x1 - y1 * (a / b);
  return d;
}
int rowNum[] = {-1, 0, 0, 1};
int colNum[] = {0, -1, 1, 0};
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  std::vector<int> v(n + 2);
  std::vector<int> idx(n + 2);
  std::vector<int> ans(n + 2);
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    idx[v[i]] = i;
  }
  for (int i = 1; i <= n; i++) ans[i] = 1;
  for (int i = n - 1; i >= 1; i--) {
    int temp = i;
    while (temp + idx[i] <= n) {
      if (v[temp + idx[i]] > i && ans[temp + idx[i]] == 1) {
        ans[idx[i]] = 0;
      }
      temp += i;
    }
    temp = i;
    while (idx[i] - temp >= 1) {
      if (v[idx[i] - temp] > i && ans[idx[i] - temp] == 1) {
        ans[idx[i]] = 0;
      }
      temp += i;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (ans[i])
      cout << "B";
    else
      cout << "A";
  }
  cout << endl;
}
