#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, sa = 0, sb = 0;
  string ans;
  cin >> n;
  while (n--) {
    scanf("%d %d", &a, &b);
    if (abs(sa + a - sb) <= 500)
      sa += a, ans += 'A';
    else
      sb += b, ans += 'G';
  }
  cout << (abs(sa - sb) <= 500 ? ans : "-1") << endl;
  return 0;
}
