#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> cum;
int main(int argc, char *argv[]) {
  int n, a, b, t;
  int x = 0, y = 0;
  cin >> n;
  string s;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b;
    if (a + x > y + 500)
      s += "G", y += b;
    else
      s += "A", x += a;
  }
  cout << s;
}
