#include <bits/stdc++.h>
using namespace std;
long long powe(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans *= a;
    b = b >> 1;
    a *= a;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool isprime(long long n) {
  long long d = sqrt(n);
  for (long long i = 2; i <= d; i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
vector<long long> A;
char C[100005];
int B[100005];
int main() {
  ios_base::sync_with_stdio(false);
  long long n, a, b, k;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    A.push_back(a);
    B[a] = i;
  }
  int indx, flag;
  for (int i = n; i > 0; i--) {
    k = B[i];
    flag = 0;
    for (int j = i + k; j < n; j += i) {
      if (A[j] > A[k] && (C[j] == 'B')) {
        flag = 1;
        break;
      }
    }
    for (int j = k - i; j >= 0; j -= i) {
      if (A[j] > A[k] && (C[j] == 'B')) {
        flag = 1;
        break;
      }
    }
    if (flag)
      C[k] = 'A';
    else
      C[k] = 'B';
  }
  for (int i = 0; i < n; i++) cout << C[i];
  return 0;
}
