#include <bits/stdc++.h>
using namespace std;
char s[9999999];
int main() {
  long long n, i, j, k, a_tk = 0, g_tk = 0, d1, d2;
  cin >> n;
  long long a[n + 1], g[n + 1];
  for (i = 0; i < n; i++) {
    cin >> a[i] >> g[i];
    a_tk += a[i];
    d1 = fabs(a_tk - g_tk);
    g_tk += g[i];
    d2 = fabs((a_tk - a[i]) - g_tk);
    if (d1 <= d2) {
      s[i] = 'A';
      g_tk -= g[i];
    } else {
      s[i] = 'G';
      a_tk -= a[i];
    }
  }
  s[i] = '\0';
  if (fabs(a_tk - g_tk) <= 500)
    cout << s << endl;
  else
    cout << "-1" << endl;
  return 0;
}
