#include <bits/stdc++.h>
using namespace std;
int abs(int x) { return (x > 0) ? (x) : (-x); }
int main() {
  int N;
  int A, G;
  int a, g;
  char res[1000010];
  while (~scanf("%d", &N)) {
    A = G = 0;
    for (int i = 0; i < N; i++) {
      scanf("%d%d", &a, &g);
      if (abs(A + a - G) <= abs(G + g - A)) {
        res[i] = 'A';
        A += a;
      } else {
        res[i] = 'G';
        G += g;
      }
    }
    if (abs(A - G) <= 500) {
      res[N] = '\0';
      printf("%s\n", res);
    } else
      printf("-1\n");
  }
  return 0;
}
