#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, a, g, sumA = 0, sumG = 0;
  vector<char> ans;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a, &g);
    if (sumA + a - sumG <= 500) {
      sumA += a;
      ans.push_back('A');
    } else if (sumG + g - sumA <= 500) {
      sumG += g;
      ans.push_back('G');
    } else {
      printf("-1");
      exit(0);
    }
  }
  for (int i = 0; i < ans.size(); i++) printf("%c", ans[i]);
  return 0;
}
