#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> v;
  while (n--) {
    int j, k;
    cin >> j >> k;
    v.push_back({j, k});
  }
  int sumA = 0, sumG = 0;
  for (auto it = v.begin(); it != v.end(); it++) {
    if (sumA + (*it).first - sumG <= 500) {
      cout << "A";
      sumA += (*it).first;
    } else if (sumG + (*it).second - sumA <= 500) {
      cout << "G";
      sumG += (*it).second;
    } else {
      cout << -1;
    }
  }
  return 0;
}
