#include <bits/stdc++.h>
using namespace std;
string raspuns;
long long n, x, y;
int read() {
  char c;
  int nr = 0;
  c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    nr = nr * 10 + (c - '0');
    c = getchar();
  }
  return nr;
}
int main() {
  n = read();
  long long sa, sg;
  sa = sg = 0;
  for (long long i = 0; i < n; i++) {
    x = read();
    y = read();
    if (sa + x - sg <= 500) {
      sa += x;
      raspuns += 'A';
    } else if (sg + y - sa <= 500) {
      sg += y;
      raspuns += 'G';
    }
  }
  if (raspuns != "\0")
    cout << raspuns;
  else
    cout << "-1";
  return 0;
}
