#include <bits/stdc++.h>
using namespace std;
void topo(int start, vector<vector<int>> &adj, queue<int> &q, bool visited[]) {
  visited[start] = true;
  int size = (int)adj[start].size();
  for (int i = 0; i < size; i++)
    if (visited[adj[start][i]] == false) topo(adj[start][i], adj, q, visited);
  q.push(start);
}
int main() {
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i];
  std::vector<vector<int>> adj(n + 1);
  for (int i = 1; i <= n; i++) {
    int curr = i + a[i];
    while (curr <= n) {
      if (a[curr] > a[i]) adj[a[i]].push_back(a[curr]);
      curr += a[i];
    }
    curr = i - a[i];
    while (curr > 0) {
      if (a[curr] > a[i]) adj[a[i]].push_back(a[curr]);
      curr -= a[i];
    }
  }
  queue<int> q;
  bool visited[n + 1];
  memset(visited, false, sizeof(visited));
  for (int i = 1; i <= n; i++)
    if (visited[a[i]] == false) topo(a[i], adj, q, visited);
  std::vector<char> v(n + 1);
  v[q.front()] = 'B';
  q.pop();
  while (!q.empty()) {
    int node = q.front();
    q.pop();
    int size = (int)adj[node].size();
    int flag = 0;
    for (int j = 0; j < size; j++) {
      if (v[adj[node][j]] == 'B') {
        v[node] = 'A';
        flag = 1;
        break;
      }
    }
    if (!flag) v[node] = 'B';
  }
  for (int i = 1; i <= n; ++i) cout << v[a[i]];
  cout << endl;
  return 0;
}
