#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long maxn = 1e5 + 10;
long long pos[maxn], a[maxn], res[maxn];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(9);
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  for (long long i = n; i >= 1; --i) {
    long long ind = pos[i];
    bool win = false;
    for (long long j = ind; j <= n; j += i) {
      if (a[j] > i) {
        if (res[j] == 0 || res[j] == 1) {
          win = true;
          goto label;
        }
      }
    }
    for (long long j = ind; j >= 1; j -= i) {
      if (a[j] > i) {
        if (res[j] == 0 || res[j] == 1) {
          win = true;
          goto label;
        }
      }
    }
  label:;
    if (win)
      res[ind] = 2;
    else
      res[ind] = 1;
  }
  for (long long i = 1; i <= n; ++i) {
    assert(res[i] != 0);
    if (res[i] == 1)
      cout << "B";
    else
      cout << "A";
  }
  cout << '\n';
  return 0;
}
