#include <bits/stdc++.h>
using namespace std;
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
struct greaterr {
  template <class T>
  bool operator()(T const &a, T const &b) const {
    return a > b;
  }
};
int main() {
  int n;
  scanf("%d", &n);
  char ans[n];
  int x, y;
  long long int suma = 0, sumb = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &y, &x);
    if (suma + y - sumb <= 500) {
      suma += y;
      printf("A");
    } else {
      sumb += x;
      printf("G");
    }
  }
  return 0;
}
