#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, a[100005] = {0}, b[100005] = {0};
  char c[100005];
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    a[b[i]] = i;
  }
  c[n] = 'B';
  for (int i = n - 1; i >= 1; i--) {
    for (int j = a[i]; j <= n; j += i) {
      if (b[j] > i) {
        if (c[b[j]] == 'B') {
          c[i] = 'A';
          break;
        } else
          c[i] = 'B';
      }
    }
    if (c[i] != 'A')
      for (int j = a[i]; j >= 1; j -= i) {
        if (b[j] > i) {
          if (c[b[j]] == 'B') {
            c[i] = 'A';
            break;
          } else
            c[i] = 'B';
        }
      }
    if (c[i] != 'A' && c[i] != 'B') c[i] = 'B';
  }
  string s;
  for (int i = 1; i <= n; i++) cout << c[b[i]];
  cout << '\n';
  return 0;
}
