#include <bits/stdc++.h>
using namespace std;
void boost() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main(void) {
  boost();
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    cin >> v[i];
  map<long long, long long> mp1;
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    mp1[v[i]] = i;
  }
  long long a[n + 1];
  for (__typeof(n + 1) i = (0) - ((0) > (n + 1));
       i != (n + 1) - ((0) > (n + 1)); i += 1 - 2 * ((0) > (n + 1)))
    a[i] = 0;
  long long t1;
  for (long long i = n; i >= 1; i--) {
    t1 = mp1[i];
    while (1) {
      t1 = t1 - i;
      if (t1 < 0) break;
      if (v[t1] > i && a[v[t1]] == 0) {
        a[i] = 1;
      }
    }
    t1 = mp1[i];
    while (1) {
      t1 = t1 + i;
      if (t1 >= n) break;
      if (v[t1] > i && a[v[t1]] == 0) {
        a[i] = 1;
      }
    }
  }
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    if (a[v[i]] == 0)
      cout << 'B';
    else
      cout << 'A';
  }
}
