#include <bits/stdc++.h>
using namespace std;
const int kNmax = 1e5 + 5;
int a[kNmax], n;
int dp[kNmax];
vector<int> g[kNmax];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = i + a[i]; j <= n; j += a[i]) {
      if (a[j] > a[i]) g[i].push_back(j);
    }
    for (int j = i - a[i]; j >= 1; j -= a[i]) {
      if (a[j] > a[i]) g[i].push_back(j);
    }
  }
  vector<pair<int, int> > w;
  for (int i = 1; i <= n; i++) w.emplace_back(a[i], i);
  sort(w.begin(), w.end());
  reverse(w.begin(), w.end());
  for (const auto& pii : w) {
    int i = pii.second;
    dp[i] = false;
    for (int j : g[i]) {
      dp[i] |= !dp[j];
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << (dp[i] ? 'A' : 'B');
  }
  cout << '\n';
  return 0;
}
