#include <bits/stdc++.h>
using namespace std;
long long int n, a[100005], dp[100005][2];
long long int ps[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (long long int i = 1; i <= n; ++i) cin >> a[i], ps[a[i]] = i;
  dp[ps[n]][0] = 0;
  dp[ps[n]][1] = 0;
  for (long long int i = n - 1; i >= 1; i--) {
    long long int v = ps[i];
    dp[v][0] = 0;
    dp[v][1] = 0;
    for (long long int m = i; m <= n; m += i) {
      long long int p1 = v - m, p2 = v + m;
      if (p1 >= 1 && a[p1] > i && dp[p1][1] == 0) {
        dp[v][0] = 1;
      }
      if (p2 <= n && a[p2] > i && dp[p2][1] == 0) {
        dp[v][0] = 1;
      }
      if (p1 >= 1 && a[p1] > i && dp[p1][0] == 0) {
        dp[v][1] = 1;
      }
      if (p2 <= n && a[p2] > i && dp[p2][0] == 0) {
        dp[v][1] = 1;
      }
    }
  }
  string res;
  for (long long int i = 1; i <= n; ++i) {
    if (dp[i][0])
      res += "A";
    else
      res += "B";
  }
  cout << res << '\n';
}
