#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 5;
int n;
int a[maxN], pos[maxN];
int f[maxN];
void ReadInput() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
}
void Optimize() {
  fill(begin(f), end(f), 0);
  for (int i = n - 1; i > 0; i--) {
    bool flag = false;
    for (int j = pos[i] + i; j <= n; j += i)
      if (a[j] > i && f[j] == 0) {
        flag = true;
        break;
      }
    if (flag) {
      f[pos[i]] = 1;
      continue;
    }
    for (int j = pos[i] - i; j > 0; j -= i)
      if (a[j] > i && f[j] == 0) {
        flag = true;
        break;
      }
    if (flag) f[pos[i]] = 1;
  }
}
void Solve() {
  for (int i = 1; i <= n; i++)
    if (f[i] == 1)
      cout << "A";
    else
      cout << "B";
}
int main() {
  ReadInput();
  Optimize();
  Solve();
}
