#include <bits/stdc++.h>
using namespace std;
struct edge {
  int t, f, w;
  bool operator<(const edge& e) const { return w > e.w; }
  edge(int from, int to, int weight) {
    t = to;
    f = from;
    w = weight;
  }
};
const double EPS = (1e-5);
int dcmp(double a, double b) { return fabs(a - b) <= EPS ? 0 : a < b ? -1 : 1; }
struct Double {
  double d;
  Double() { d = 0.0; };
  Double(double d) : d(d) {}
  bool operator<(const Double& D) const { return dcmp(d, D.d) < 0; }
  bool operator>(const Double& D) const { return dcmp(d, D.d) > 0; }
  bool operator==(const Double& D) const { return dcmp(d, D.d) == 0; }
};
bool intersectSegments(complex<double> a, complex<double> b, complex<double> c,
                       complex<double> d, complex<double>& intersect) {
  double d1 = ((conj(a - b) * (d - c)).imag()),
         d2 = ((conj(a - c) * (d - c)).imag()),
         d3 = ((conj(a - b) * (a - c)).imag());
  if (fabs(d1) < EPS) return false;
  double t1 = d2 / d1, t2 = d3 / d1;
  intersect = a + (b - a) * t1;
  if (t1 < -EPS || t2 < -EPS || t2 > 1 + EPS) return false;
  return true;
}
class UnionFind {
 private:
  vector<int> p, rank, setSize;
  int numSets;

 public:
  UnionFind(int N) {
    setSize.assign(N, 1);
    numSets = N;
    rank.assign(N, 0);
    p.assign(N, 0);
    for (int i = 0; i < N; i++) p[i] = i;
  }
  int findSet(int i) { return (p[i] == i) ? i : (p[i] = findSet(p[i])); }
  bool isSameSet(int i, int j) { return findSet(i) == findSet(j); }
  void unionSet(int i, int j) {
    if (!isSameSet(i, j)) {
      numSets--;
      int x = findSet(i), y = findSet(j);
      if (rank[x] > rank[y]) {
        p[y] = x;
        setSize[x] += setSize[y];
      } else {
        p[x] = y;
        setSize[y] += setSize[x];
        if (rank[x] == rank[y]) rank[y]++;
      }
    }
  }
  int numDisjointSets() { return numSets; }
  int sizeOfSet(int i) { return setSize[findSet(i)]; }
};
struct line {
  double a, b, c;
};
long long binpowmod(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
long long binpow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
int findXOR(int n) {
  switch (n % 4) {
    case 0:
      return n;
    case 1:
      return 1;
    case 2:
      return n + 1;
    case 3:
      return 0;
  }
}
int rangeXOR(int l, int r) { return (findXOR(l - 1) ^ findXOR(r)); }
int getbit(int mask, int bit) { return (mask & (1 << bit)); }
void setbit(int& mask, int bit, int val) {
  if (val)
    mask |= (1 << bit);
  else
    mask &= ~(1 << bit);
}
#pragma GCC target("sse4.2")
const int N = 2e5 + 10;
const int M = 500 + 10;
const long long INF = 1e9 + 100;
void solve() {
  int n;
  cin >> n;
  map<int, int> done;
  vector<pair<int, int> > a(n);
  vector<int> ans(n, -1);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    a[i] = {x, i};
  }
  sort(a.rbegin(), a.rend());
  for (int i = 0; i < n; ++i) {
    if (!done.size())
      ans[a[i].second] = 1;
    else {
      bool one = false;
      for (int j = a[i].first; j <= n; j += a[i].first) {
        if (done.count(a[i].second + j)) {
          if (done[a[i].second + j]) one = true;
        }
        if (done.count(a[i].second - j)) {
          if (done[a[i].second - j]) one = true;
        }
      }
      if (one)
        ans[a[i].second] = 0;
      else
        ans[a[i].second] = 1;
    }
    done[a[i].second] = ans[a[i].second];
  }
  for (int i = 0; i < n; ++i) {
    if (ans[i])
      cout << 'B';
    else
      cout << 'A';
  }
}
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tc = 1;
  while (tc--) {
    solve();
  }
}
