#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, total = 0;
  scanf("%d", &(n));
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &(a), &(b));
    if (total + a <= 500) {
      total += a;
      printf("A");
    } else {
      total -= b;
      printf("G");
    }
  }
  return 0;
}
