#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 15;
long long a[N], vis[N], mp[N];
int main() {
  long long n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    mp[a[i]] = i;
  }
  for (int i = n; i >= 1; i--) {
    long long op = mp[i];
    op = op % i;
    if (op == 0) op += i;
    for (int j = op; j <= n; j += i) {
      if (a[j] > i && vis[a[j]] == 0) {
        vis[i] = 1;
        break;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (vis[a[i]])
      cout << "A";
    else
      cout << "B";
  }
  cout << endl;
  return 0;
}
