#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n, m1 = 0, m2 = 0, mn1 = INT_MAX, mn2 = INT_MAX, s1 = 0, s2 = 0;     cin >> n;     vector<pair<int, int> > vt;     long long tmp1, tmp2;     for (int i = 0; i < n; i++) {       cin >> tmp1 >> tmp2;       vt.push_back(make_pair(tmp1, tmp2));     }     string ans =   ;     tmp1 = 0, tmp2 = 0;     for (int i = 0; i < n; i++) {       if (tmp2 + vt[i].second <= tmp1 + 500) {         tmp2 += vt[i].second;         ans +=  G ;       } else {         tmp1 += vt[i].first;         ans +=  A ;       }     }     if (!(abs(tmp1 - tmp2) <= 500)) {       cout << -1;       return 0;     }     cout << ans <<   n ;     return 0;   }   