#include <bits/stdc++.h>
using namespace std;
inline long long rd() {
  char c;
  while (c = getchar(), c < '0' || c > '9')
    ;
  long long X = c - 48;
  while (c = getchar(), c >= '0' && c <= '9') X = X * 10 + c - 48;
  return X;
}
template <class T>
inline void print(T x) {
  if (x < 0) {
    putchar('-');
    return print(-x);
  }
  if (x < 10) {
    putchar('0' + x);
    return;
  }
  print(x / 10);
  putchar(x % 10 + '0');
}
string s;
void solve(int n, vector<int> &a) {
  if (n == 1) {
    s = "B";
    return;
  }
  vector<int> idx(n + 1);
  s = string(n, 'B');
  for (__typeof(0) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - (((0) > (n)) << 1))
    idx[a[i]] = i;
  for (__typeof(n + 1) i = (n + 1) - ((n + 1) > (1));
       i != (1) - ((n + 1) > (1)); i += 1 - (((n + 1) > (1)) << 1)) {
    for (int j = idx[i] - i; j >= 0; j -= i) {
      if (a[j] > i and s[j] == 'B') {
        s[idx[i]] = 'A';
        break;
      }
    }
    for (int j = idx[i] + i; j < n; j += i) {
      if (a[j] > i and s[j] == 'B') {
        s[idx[i]] = 'A';
        break;
      }
    }
  }
}
int32_t main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &i : a) cin >> i;
  solve(n, a);
  cout << s << "\n";
  return 0;
}
