#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int p[MAXN], pos[MAXN];
bool winning[MAXN];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p[i]);
    pos[p[i]] = i;
  }
  for (int num = n - 1; num >= 1; num--) {
    int m_pos = pos[num];
    int m_mod = m_pos % num;
    int start = m_mod;
    if (m_mod = 0) start = num;
    bool can_win = false;
    for (int i = start; i <= n; i += num) {
      if (p[i] > num && !winning[p[i]]) can_win = true;
    }
    winning[num] = can_win;
  }
  for (int i = 1; i <= n; i++) {
    printf("%c", winning[p[i]] ? 'A' : 'B');
  }
  return 0;
}
