#include <bits/stdc++.h>
using namespace std;
int a[100010];
int b[100010];
int ans[100010];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    b[a[i]] = i;
  }
  ans[b[n]] = 0;
  for (int i = n - 1; i >= 1; i--) {
    int idx = b[i];
    int flag = 0;
    for (int j = idx + i; j <= n; j += i) {
      if (a[j] > i && ans[j] == 0) {
        flag = 1;
        break;
      }
    }
    for (int j = idx - i; j >= 1; j -= i) {
      if (a[j] > i && ans[j] == 0) {
        flag = 1;
        break;
      }
    }
    if (flag == 1) {
      ans[idx] = 1;
    } else {
      ans[idx] = 0;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (ans[i]) {
      cout << 'A';
    } else {
      cout << 'B';
    }
  }
}
