#include <bits/stdc++.h>
using namespace std;
const double EPS = 1E-9;
int n, g, s1, s2, ans;
int a[1000001], pos[1000001];
char k[1000011];
bool cmp(int x, int y) { return a[x] < a[y]; }
int main() {
  scanf("%d\n", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d\n", &a[i], &g);
    k[i] = 'G';
    s1 += g;
    pos[i] = i;
  }
  sort(pos, pos + n, cmp);
  for (int i = 0; i < n; i++) {
    if (abs(s1 - s2) <= 500)
      break;
    else {
      s2 += a[pos[i]];
      s1 = s1 - (1000 - a[pos[i]]);
      k[pos[i]] = 'A';
    }
  }
  if (abs(s1 - s2) <= 500) {
    for (int i = 0; i < n; i++) {
      printf("%c", k[i]);
    }
  } else
    cout << -1;
  return 0;
}
