#include <bits/stdc++.h>
using namespace std;
int a[200005], win[200005], pos[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  char ans[200005];
  cin >> n;
  for (int i = 0; i < int(n); ++i) cin >> a[i], pos[a[i]] = i;
  if (n == 1) return cout << "B", 0;
  win[1] = 1;
  for (int i = n - 1; i > 1; i--) {
    for (int j = pos[i] + i; j < n; j += i) {
      if (a[j] > i && win[a[j]] == 0) {
        win[i] = 1;
        break;
      }
    }
    if (win[i]) {
      ans[pos[i]] = 'A';
      continue;
    }
    for (int j = pos[i] - i; j >= 0; j -= i) {
      if (a[j] > i && win[a[j]] == 0) {
        win[i] = 1;
        break;
      }
    }
    if (win[i])
      ans[pos[i]] = 'A';
    else
      ans[pos[i]] = 'B';
  }
  ans[pos[1]] = 'A';
  ans[pos[n]] = 'B';
  cout << ans;
  return 0;
}
