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