#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int suma = 0, sumg = 0, a, g;     char *arr = new char[n];     for (int i = 0; i < n; i++) {       scanf( %d %d , &a, &g);       if (abs(suma + a - sumg) < abs(sumg + g - suma)) {         suma += a;         arr[i] =  A ;       } else {         sumg += g;         arr[i] =  G ;       }     }     if (abs(suma - sumg) > 500)       cout <<  -1 ;     else       for (int i = 0; i < n; i++) cout << arr[i];     cout << endl;     return 0;   }   