#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, dif = 0, x, y;
  cin >> n;
  while (n--) {
    scanf("%d%d", &x, &y);
    if (abs(dif + x) <= abs(dif - y))
      dif += x, printf("A");
    else
      dif -= y, printf("G");
  }
}
