#include <bits/stdc++.h>
using namespace std;
bool is_prime(long long x) {
  if (x == 1 || x == 4) return false;
  if (x == 2 || x == 3 || x == 5) return true;
  auto bla = sqrt(x);
  for (int i = 2; i <= bla + 2; ++i) {
    if (x % i == 0) return false;
  }
  return true;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  vector<pair<int, int>> a;
  for (int i = 0; i < n; ++i) {
    int b;
    cin >> b;
    a.emplace_back(b, i);
  }
  auto b = a;
  sort(b.begin(), b.end());
  vector<bool> result(n, false);
  for (int i = n - 2; i >= 0; --i) {
    int pos = b[i].second;
    int value = i + 1;
    for (int j = pos + value; j < n; j += value) {
      if (a[j].first > value) {
        if (result[j] == false) {
          result[pos] = true;
          break;
        }
      }
    }
    for (int j = pos - value; j >= 0; j -= value) {
      if (a[j].first > value) {
        if (result[j] == false) {
          result[pos] = true;
          break;
        }
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    if (result[i])
      cout << 'A';
    else
      cout << 'B';
  }
  return 0;
}
