#include <bits/stdc++.h>
using namespace std;
long long n, a[100001], b[100001], c[100001], k, x;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[a[i]] = i;
  }
  c[b[n]] = 0;
  for (long long i = n - 1; i >= 1; i--) {
    x = b[i];
    for (long long j = (x - 1) % i + 1; j <= n; j += i) {
      if (a[j] > i && c[j] == 0) {
        c[x] = 1;
        break;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (c[i])
      cout << "A";
    else
      cout << "B";
  }
}
