#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
const long long M = 1e9 + 7;
long long nums[N];
long long idx[N];
bool ans[N];
vector<long long> check[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, i, j, k, l, t, a, b, x, y;
  cin >> n;
  for (i = 1; i < n + 1; i += 1) cin >> nums[i], idx[nums[i]] = i;
  for (i = 1; i < n + 1; i += 1) {
    x = nums[i];
    y = i;
    while (y + x <= n) {
      if (nums[y + x] > x) check[x].push_back(nums[y + x]);
      y = y + x;
    }
    y = i;
    while (y - x > 0) {
      if (nums[y - x] > x) check[x].push_back(nums[y - x]);
      y = y - x;
    }
  }
  for (i = n; i >= 1; i -= 1) {
    if (check[i].size() == 0)
      ans[i] = 0;
    else {
      for (j = 0; j < check[i].size(); j += 1)
        ans[i] = ans[i] | (ans[check[i][j]] == 0);
    }
  }
  for (i = 1; i < n + 1; i += 1) ans[nums[i]] == 0 ? cout << "B" : cout << "A";
  return 0;
}
