#include <bits/stdc++.h>
using namespace std;
int n;
void solve(int i, vector<bool>& visited, vector<int>& win,
           const vector<int>& v) {
  if (win[i] != -1) {
    return;
  }
  visited[i] = true;
  for (int j = i - (i / v[i]) * v[i]; j < n + 1; j += v[i]) {
    if (v[j] <= v[i]) {
      continue;
    }
    if (!visited[j] && win[j] == -1) {
      solve(j, visited, win, v);
    }
    if (win[j] == 0) {
      win[i] = 1;
      return;
    }
  }
  win[i] = 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  vector<int> v(n + 1);
  for (int i = 1; i < n + 1; ++i) {
    cin >> v[i];
  }
  vector<bool> visited(n + 1, false);
  vector<int> win(n + 1, -1);
  auto max_it = max_element(v.begin(), v.end());
  auto min_it = min_element(v.begin(), v.end());
  win[max_it - v.begin()] = 0;
  win[min_it - v.begin()] = 1;
  visited[max_it - v.begin()] = visited[min_it - v.begin()] = true;
  for (int i = 1; i < n + 1; ++i) {
    solve(i, visited, win, v);
  }
  for (int i = 1; i < n + 1; ++i) {
    if (win[i] == 1) {
      cout << 'A';
    } else if (win[i] == 0) {
      cout << 'B';
    } else {
      assert(false);
    }
  }
  cout << '\n';
}
