#include <bits/stdc++.h>
using namespace std;
int n, a[100005], pozinit[100005];
char ans[100005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], pozinit[a[i]] = i;
  for (int i = n; i >= 1; i--) {
    for (int j = pozinit[i] - i; j >= 1; j -= i)
      if (ans[j] == 'B') ans[pozinit[i]] = 'A';
    for (int j = i + pozinit[i]; j <= n; j += i)
      if (ans[j] == 'B') ans[pozinit[i]] = 'A';
    if (ans[pozinit[i]] != 'A') ans[pozinit[i]] = 'B';
  }
  ans[n + 1] = 0;
  cout << (ans + 1) << "\n";
  return 0;
}
