#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  int g = 0, a = 0, flag = 0;
  string s = "";
  while (n--) {
    int a1, g1;
    cin >> a1 >> g1;
    a += a1;
    if (abs(a - g) <= 500) {
      s += 'A';
      continue;
    } else {
      a -= a1;
      g += g1;
      if (abs(a - g) <= 500) {
        s += 'G';
        continue;
      } else {
        flag = 1;
      }
    }
  }
  if (flag)
    cout << -1;
  else
    cout << s;
  return 0;
}
