#include <bits/stdc++.h>
using namespace std;
int dr[] = {1, 0, -1, 0, -1, -1, 1, 1};
int dc[] = {0, -1, 0, 1, -1, 1, -1, 1};
const int MAX = 1e6 + 7;
const int MOD = 1e9 + 7;
using namespace std;
int main() {
  int n, tot = 0;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    int a, b;
    scanf("%d", &a), scanf("%d", &b);
    if (tot + a <= 500) {
      tot += a;
      printf("A");
    } else {
      tot -= b;
      printf("G");
    }
  }
}
