#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  vector<pair<int, int> > sorted;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sorted.push_back({a[i], i});
  }
  sort((sorted).begin(), (sorted).end());
  reverse((sorted).begin(), (sorted).end());
  vector<bool> win(n, false);
  for (int pos = 0; pos < n; ++pos) {
    int i = sorted[pos].second;
    for (int d = a[i]; d < n; d += a[i]) {
      int j = i - d;
      if (j >= 0 && a[j] > a[i] && !win[j]) {
        win[i] = true;
      }
      j = i + d;
      if (j < n && a[j] > a[i] && !win[j]) {
        win[i] = true;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << (win[i] ? 'A' : 'B');
  }
  cout << "\n";
}
