#include <bits/stdc++.h>
using namespace std;
const int max_n = 100005;
int dp[max_n];
int a[max_n];
int w[max_n];
int n;
set<int> s;
vector<int> v[max_n];
int dfs(int now) {
  if (dp[now] != -1) return dp[now];
  if (a[now] == n) return dp[now] = 0;
  int res = 0;
  for (int i = now; i < n; i += a[now]) {
    if (a[i] > a[now]) res |= !dfs(i);
  }
  for (int i = now - a[now]; i >= 0; i -= a[now]) {
    if (a[i] > a[now]) res |= !dfs(i);
  }
  return dp[now] = res;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i), w[a[i]] = i;
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < n; i++) {
    if (dfs(i))
      printf("A");
    else
      printf("B");
  }
  return 0;
}
