#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  long long a[n], b[n + 1];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    b[a[i]] = i;
  }
  vector<char> ans(n);
  for (long long i = n; i >= 1; i--) {
    ans[b[i]] = 'B';
    for (long long j = b[i]; j < n; j += i) {
      if (a[j] > i and ans[j] == 'B') ans[b[i]] = 'A';
    }
    for (long long j = b[i]; j >= 0; j -= i) {
      if (a[j] > i and ans[j] == 'B') ans[b[i]] = 'A';
    }
  }
  for (auto it : ans) cout << it;
}
