#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const int maxn = 100100;
int n;
int a[maxn + 5];
int pos[maxn + 5];
int dp[maxn + 5];
int main() {
  scanf("%d", &n);
  for (int i = (0), i_end_ = (n); i < i_end_; ++i)
    scanf("%d", a + i), pos[a[i]] = i;
  memset(dp, -1, sizeof dp);
  for (int i = n; i >= 1; --i) {
    dp[pos[i]] = 0;
    for (int j = i; j < n; j += i) {
      for (int k = (0), k_end_ = (2); k < k_end_; ++k) {
        int nxt = k ? pos[i] + j : pos[i] - j;
        if (nxt >= 0 && nxt < n && a[nxt] > i) {
          if (!dp[nxt]) {
            dp[pos[i]] = 1;
          }
        }
      }
    }
  }
  for (int i = (0), i_end_ = (n); i < i_end_; ++i)
    if (dp[i])
      putchar('A');
    else
      putchar('B');
  return 0;
}
