#include <bits/stdc++.h>
using namespace std;
bool br1, br2, br;
long long n, k, x, y, z, mini, maxi, w, l, ind, ini, sum, t, len, r, q, m,
    imini;
long long b[(int)1e6 + 100];
long long a[(int)1e6 + 100];
vector<pair<long long, long long> > v;
void solve() {
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    v.push_back(make_pair(a[i], i));
  }
  sort(v.begin(), v.end(), greater<pair<long long, long long> >());
  b[v[0].second] = 2;
  for (long long i = 1; i < n; i++) {
    m = v[i].first;
    x = v[i].second;
    br = 0;
    while (x >= 0) {
      if (a[x] > v[i].first && b[x] == 2) {
        br = 1;
        break;
      }
      x -= v[i].first;
    }
    x = v[i].second;
    while (x < n) {
      if (a[x] > v[i].first && b[x] == 2) {
        br = 1;
        break;
      }
      x += v[i].first;
    }
    if (br)
      b[v[i].second] = 1;
    else
      b[v[i].second] = 2;
  }
  for (long long i = 0; i < n; i++) cout << (b[i] == 2 ? 'B' : 'A');
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  solve();
  return 0;
}
