#include <bits/stdc++.h>
using namespace std;
int n, m, s1, s2, a, b;
string s;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a, &b);
    if ((s1 + a) - s2 > 500) {
      s2 += b;
      s += 'G';
    } else
      s1 += a, s += 'A';
  }
  if (s1 - s2 > 500) {
    cout << -1;
  } else
    cout << s;
}
