#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int a = 0, g = 0;
  string ans = "";
  for (int i = 0; i < n; i++) {
    int A, B;
    cin >> A >> B;
    if (a + A <= 500 + g) {
      ans += "A";
      a += A;
    } else {
      ans += "G";
      g += B;
    }
  }
  if (abs(a - g) > 500)
    cout << -1;
  else
    cout << ans;
  return 0;
}
