#include <bits/stdc++.h>
using namespace std;
int inf = 2000000000;
template <typename t>
t gcd(t a, t b) {
  return (!b) ? a : gcd(b, a % b);
}
template <typename t>
t pow(t a, t b) {
  if (b == 0) return 1;
  t cur = pow(a, b / 2);
  if (b % 2 == 0)
    return cur * cur;
  else
    return cur * cur * a;
}
template <typename t>
bool isOk(t x, t y, t boundX, t boundY) {
  return ((x >= 0) && (y >= 0) && (x < boundX) && (y < boundY));
}
int dx[] = {0, 0, 1, -1, 1, -1, -1, 1};
int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
double square(vector<pair<double, double>> nodes) {
  double area = 0;
  int numPoints = nodes.size();
  int j = numPoints - 1;
  for (int i = 0; i < numPoints; i++) {
    area = area + (nodes[j].first + nodes[i].first) *
                      (nodes[j].second - nodes[i].second);
    j = i;
  }
  return area / 2;
}
int calcMap(map<int, int> m) {
  int sum = 0;
  for (auto i : m) {
    sum += i.second;
  }
  return sum;
}
struct PointF {
  double X;
  double Y;
  PointF(double x, double y) {
    X = x;
    Y = y;
  }
};
double distance(double x1, double y1, double x2, double y2) {
  return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
int solveWek(int n) {
  bool *check = new bool[n]();
  int iter = 1;
  for (int i = 1; i < n; i++) {
    check[iter] = 1;
    while (check[iter]) {
      iter = (iter + 1) % n;
    }
    iter = (iter + 1) % n;
    while (check[iter]) {
      iter = (iter + 1) % n;
    }
  }
  delete[] check;
  return iter + 1;
}
int solveKhoriv(int n) {
  bool *check = new bool[n]();
  int counter = 1;
  int state = 0;
  while (counter < n) {
    int iter = 0;
    if (state) {
      while (check[iter]) iter++;
      iter++;
    }
    state = !state;
    while (iter < n) {
      while (check[iter]) iter++;
      if (iter >= n) break;
      check[iter] = 1;
      counter++;
      while (check[iter]) iter++;
      iter++;
      while (check[iter]) iter++;
    }
  }
  int iter = 0;
  while (check[iter]) iter++;
  delete[] check;
  return iter + 1;
}
pair<long long, long long> solve(long long n) {
  long long left = 2, right = 2;
  long long rightNext = 4;
  long long ansL = 0, ansR = 0;
  while (left * 2 < n) {
    ansR += right / 2;
    ansL += left - right / 2;
    left *= 2;
    if (left >= right + rightNext) {
      right += rightNext;
      rightNext *= 4;
    }
  }
  if (right / 2 >= (n - left + 1)) {
    ansR += (n - left + 1);
  } else {
    ansR += right / 2;
    ansL += (n - left + 1) - right / 2;
  }
  left = 2, right = 6;
  rightNext = 16;
  while (right <= n) {
    while (left * 2 < right) left *= 2;
    long long reverse = min(right / 2, n - left + 1) - right + left;
    right += rightNext;
    rightNext *= 4;
    ansL -= reverse;
    ansR += reverse;
  }
  return {ansL, ansR};
};
struct mp {
  mp(int _x, int _y) {
    x = _x;
    y = _y;
  }
  mp(){};
  long long x, y;
  friend bool operator<(mp rhs, mp another) {
    return (long long)(rhs.x + (long long)rhs.y * 322) <
           (long long)(another.x + (long long)another.y * 322);
  }
  friend bool operator==(mp rhs, mp another) {
    return (long long)(rhs.x + (long long)rhs.y * 322) ==
           (long long)(another.x + (long long)another.y * 322);
  }
};
long long bits[] = {
    1,         2,         4,          8,         16,       32,       64,
    128,       256,       512,        1024,      2048,     4096,     8192,
    16384,     32768,     65536,      131072,    262144,   524288,   1048576,
    2097152,   4194304,   8388608,    16777216,  33554432, 67108864, 134217728,
    268435456, 536870912, 1073741824, 2147483648};
vector<int> a;
map<int, int> mapa;
vector<int> v;
const int loss = 1;
const int win = 2;
int res[100001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  a.resize(n + 1);
  v.resize(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    v[a[i]] = i;
  }
  res[n] = loss;
  for (int i = n; i >= 1; --i) {
    int t = a[v[i]];
    int s = v[i] % t;
    bool b = false;
    for (int j = s; j <= n; j += a[v[i]]) {
      if (a[j] > a[v[i]]) {
        if (res[j] == loss) {
          res[v[i]] = win;
          b = true;
          break;
        }
      }
    }
    if (!b) {
      res[v[i]] = loss;
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (res[i] == win) cout << "A";
    if (res[i] == loss) cout << "B";
  }
  return 0;
}
