#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, x, m, j;
  cin >> n;
  string s(n + 1, '?');
  string ans(n, '?');
  vector<int> a(n);
  for (i = 0; i < n; i++) cin >> a[i];
  vector<vector<int> > b(n + 1);
  for (i = 0; i < n; i++) {
    x = a[i];
    j = i;
    while (x + j < n) {
      if (a[i] < a[x + j]) b[a[i]].push_back(a[x + j]);
      j += x;
    }
    j = i;
    while (j - x >= 0) {
      if (a[i] < a[j - x]) b[a[i]].push_back(a[j - x]);
      j -= x;
    }
  }
  s[n] = 'B';
  for (i = n - 1; i > 0; i--) {
    m = b[i].size();
    s[i] = 'B';
    for (j = 0; j < m; j++) {
      if (s[b[i][j]] == 'B') s[i] = 'A';
    }
  }
  for (i = 0; i < n; i++) {
    ans[i] = s[a[i]];
  }
  cout << ans;
  return 0;
}
