#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(false);
  int n, sum = 0;
  cin >> n;
  while (n--) {
    int a, g;
    cin >> a >> g;
    if (sum + a <= 500) {
      cout << "A";
      sum += a;
    } else {
      cout << "G";
      sum -= g;
    }
  }
  return 0;
}
