#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int n;
  cin >> n;
  vector<long long int> a(n + 1), h(n + 1), b(n + 1, -1);
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
    h[a[i]] = i;
  }
  b[h[n]] = -1;
  for (long long int i = n - 1; i >= 1; i--) {
    long long int ind = h[i];
    long long int win = 0, los = 0;
    for (long long int j = ind + i; j <= n; j += i) {
      if (a[j] > i) {
        if (b[j] == 1) {
          win++;
        } else {
          los++;
        }
      }
    }
    for (long long int j = ind - i; j >= 1; j -= i) {
      if (a[j] > i) {
        if (b[j] == 1) {
          win++;
        } else {
          los++;
        }
      }
    }
    if (los == 0 && win == 0) {
      b[ind] = -1;
    } else if (los == 0) {
      b[ind] = -1;
    } else {
      b[ind] = 1;
    }
  }
  for (long long int i = 1; i <= n; i++) {
    if (b[i] == 1) {
      cout << "A";
    } else {
      cout << "B";
    }
  }
}
