#include <bits/stdc++.h>
using namespace std;
const int OO = 0x3f3f3f3f, N = 1e6 + 5, mod = 1e9 + 7;
int n, sum, x, y;
pair<int, int> a[N], g[N];
char ans[N];
int main() {
  cin >> n;
  ans[n] = '\0';
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &x, &y);
    a[i] = {x, i}, g[i] = {y, i};
  }
  sort(a, a + n);
  sort(g, g + n);
  int ia = 0, ig = 0;
  while (ia < n || ig < n) {
    if (ia < n && ans[a[ia].second] != 0)
      ++ia;
    else if (ig < n && ans[g[ig].second] != 0)
      ++ig;
    else if (ia < n && sum + a[ia].first <= 500)
      ans[a[ia].second] = 'A', sum += a[ia++].first;
    else
      ans[g[ig].second] = 'G', sum -= g[ig++].first;
  }
  printf("%s", ans);
  return 0;
}
