#include <bits/stdc++.h>
using namespace std;
long long const N = 100050;
long long a[N];
vector<long long> g[N];
vector<bool> win(N);
long long pos[N], vis[N];
void dfs(long long node) {
  vis[node] = 1;
  for (auto ax : g[node]) {
    if (!vis[ax]) dfs(ax);
    win[node] = win[node] | (!win[ax]);
  }
}
char ans[N];
signed main() {
  ios::sync_with_stdio(0);
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = i + a[i]; j <= n; j += a[i]) {
      if (a[j] > a[i]) g[a[i]].push_back(a[j]);
    }
    for (long long j = i - a[i]; j >= 1; j -= a[i]) {
      if (a[j] > a[i]) g[a[i]].push_back(a[j]);
    }
  }
  for (long long i = 1; i <= n; i++) {
    if (!vis[i]) dfs(i);
  }
  for (long long i = 1; i <= n; i++) {
    if (win[i]) {
      ans[pos[i]] = 'A';
    } else
      ans[pos[i]] = 'B';
  }
  for (long long i = 1; i <= n; i++) cout << ans[i];
  return 0;
}
