#include <bits/stdc++.h>
using namespace std;
template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };
  std::vector<edge> edges;
  std::vector<std::vector<int>> g;
  int n;
  graph(int _n) : n(_n) { g.resize(n); }
  virtual int add(int from, int to, T cost) = 0;
};
template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;
  digraph(int _n) : graph<T>(_n) {}
  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int)edges.size();
    g[from].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }
  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (auto &e : edges) {
      rev.add(e.to, e.from, e.cost);
    }
    return rev;
  }
};
template <typename T>
std::vector<int> find_topsort(const digraph<T> &g) {
  std::vector<int> deg(g.n, 0);
  for (int id = 0; id < (int)g.edges.size(); id++) {
    deg[g.edges[id].to]++;
  }
  std::vector<int> x;
  for (int i = 0; i < g.n; i++) {
    if (deg[i] == 0) {
      x.push_back(i);
    }
  }
  for (int ptr = 0; ptr < (int)x.size(); ptr++) {
    int i = x[ptr];
    for (int id : g.g[i]) {
      auto &e = g.edges[id];
      int to = e.to;
      if (--deg[to] == 0) {
        x.push_back(to);
      }
    }
  }
  if ((int)x.size() != g.n) {
    return vector<int>();
  }
  return x;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  digraph<int> g(n);
  for (int i = 0; i < n; ++i) {
    for (int j = i + a[i]; j < n; j += a[i]) {
      if (a[j] > a[i]) {
        g.add(i, j);
      }
    }
    for (int j = i - a[i]; j >= 0; j -= a[i]) {
      if (a[j] > a[i]) {
        g.add(i, j);
      }
    }
  }
  vector<bool> alice(n);
  digraph<int> rev = g.reverse();
  vector<int> ts = find_topsort(rev);
  for (int i = 0; i < n; ++i) {
    for (int id : rev.g[ts[i]]) {
      auto e = rev.edges[id];
      int from = e.from;
      int to = e.to;
      alice[to] = alice[to] || (alice[from] ^ 1);
    }
  }
  for (int i = 0; i < n; ++i) {
    cout << (alice[i] ? 'A' : 'B');
  }
  cout << '\n';
  return 0;
}
