#include <bits/stdc++.h>
using namespace std;
const int N = 1010000, inf = 10101010;
struct tim {
  int w, id;
  bool operator<(const tim t) const { return w < t.w; };
} a[N];
int f[N] = {0};
int main() {
  int n, e;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].w >> e, a[i].id = i;
  sort(a + 1, a + n + 1);
  int flag = 0, x = 1, y = n, sa = 0, sg = 0, sum = 0;
  while (++flag <= n) {
    while (x <= y && x <= n && sa + a[x].w <= sg + 500 && f[a[x].id] == 0)
      sa += a[x].w, f[a[x++].id] = 1, sum++;
    while (x <= y && y >= 1 && sg + (1000 - a[y].w) <= sa + 500 &&
           f[a[y].id] == 0)
      sg += (1000 - a[y].w), f[a[y--].id] = 2, sum++;
  }
  if (sum == n) {
    for (int i = 1; i <= n; i++)
      if (f[i] == 1)
        cout << 'A';
      else
        cout << 'G';
    cout << endl;
  } else
    cout << -1 << endl;
}
