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