#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int a[n][2];     for (int i = 0; i < n; i++) {       cin >> a[i][0] >> a[i][1];     }     int sum1 = 0;     int sum2 = 0;     for (int i = 0; i < n; i++) {       if (abs(sum1 + a[i][0] - sum2) <= 500) {         sum1 += a[i][0];         a[i][0] = -1;       } else {         sum2 += a[i][1];       }     }     if (abs(sum1 - sum2) > 500) {       cout <<  -1 ;     } else {       for (int i = 0; i < n; i++) {         if (a[i][0] == -1) {           cout <<  A ;         } else {           cout <<  G ;         }       }     }     return 0;   }   