#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int diff = 0;
  string ans;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (diff + a <= 500) {
      ans += 'A';
      diff += a;
    } else if (diff - b >= -500) {
      ans += 'G';
      diff -= b;
    } else {
      cout << -1;
      return 0;
    }
  }
  cout << ans;
  return 0;
}
