#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, total = 0, data1, data2, a, i;
  char hasil[1000005];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d", &data1, &data2);
    a = total - data2;
    if (total + data1 > abs(a)) {
      total = a;
      hasil[i] = 'G';
    } else {
      total += data1;
      hasil[i] = 'A';
    }
  }
  hasil[n] = '\0';
  if (abs(total) <= 500)
    printf("%s", hasil);
  else
    printf("-1");
  return 0;
}
