Problem: The Bitlandians are quite weird people. They have very peculiar customs.

As is customary, Uncle J. wants to have n eggs painted for Bitruz (an ancient Bitland festival). He has asked G. and A. to do the work.

The kids are excited because just as is customary, they're going to be paid for the job! 

Overall uncle J. has got n eggs. G. named his price for painting each egg. Similarly, A. named his price for painting each egg. It turns out that for each egg the sum of the money both A. and G. want for the painting equals 1000.

Uncle J. wants to distribute the eggs between the children so as to give each egg to exactly one child. Also, Uncle J. wants the total money paid to A. to be different from the total money paid to G. by no more than 500.

Help Uncle J. Find the required distribution of eggs or otherwise say that distributing the eggs in the required manner is impossible.

Input

The first line contains integer n (1 ≤ n ≤ 106) — the number of eggs.

Next n lines contain two integers ai and gi each (0 ≤ ai, gi ≤ 1000; ai + gi = 1000): ai is the price said by A. for the i-th egg and gi is the price said by G. for the i-th egg.

Output

If it is impossible to assign the painting, print "-1" (without quotes).

Otherwise print a string, consisting of n letters "G" and "A". The i-th letter of this string should represent the child who will get the i-th egg in the required distribution. Letter "A" represents A. and letter "G" represents G. If we denote the money Uncle J. must pay A. for the painting as Sa, and the money Uncle J. must pay G. for the painting as Sg, then this inequality must hold: |Sa - Sg| ≤ 500. 

If there are several solutions, you are allowed to print any of them.

Examples

Input

2
1 999
999 1


Output

AG


Input

3
400 600
400 600
400 600


Output

AGA

Solution (in JAVA):

Solution:
import static java.lang.Integer.MIN_VALUE;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.Short.parseShort;
import static java.lang.Byte.parseByte;

import java.awt.image.AreaAveragingScaleFilter;
import java.io.*;
import java.util.*;

public class Contest {

    static int nextInt() throws IOException {
        return parseInt(next());
    }

    static long nextLong() throws IOException {
        return parseLong(next());
    }

    static short nextShort() throws IOException {
        return parseShort(next());
    }

    static byte nextByte() throws IOException {
        return parseByte(next());
    }

    static String next() throws IOException {
        while (tok == null || !tok.hasMoreTokens())
            tok = new StringTokenizer(in.readLine());
        return tok.nextToken();
    }

    static String nextLine() throws IOException {
        return in.readLine();
    }

    private static BufferedReader in;
    private static StringTokenizer tok;
    private static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws Exception {
        in = new BufferedReader(new InputStreamReader(System.in));

        /*--------------------SolutionStarted-------------------*/
        solve();
        /*--------------------SolutionEnded--------------------*/

        in.close();
        out.close();
    }


    static int n, m,k,
            count =0, length=0, sum =0,
            q, t,
            idx, temp;
    static char[] s;
    static int max = Integer.MIN_VALUE, min = Integer.MAX_VALUE;
    static long lMax = Long.MAX_VALUE, lMin = Long.MIN_VALUE;
    static int[] nums;
    static void solve() throws IOException {
        n = nextInt();
        long A = 0, G = 0;
        int[] a = new int[n], g = new int[n];
        s = new char[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
            g[i] = nextInt();
        }
        for (int i = 0; i < n; i++) {
            if (((A + a[i])-G<=500)||((A+a[i]-G)<=(G-g[i]-A))) {
                A += a[i];
                s[i] = 'A';
            } else{
                G += g[i];
                s[i] = 'G';
            }
        }
        if (Math.abs(A - G) <= 500) {
            out.println(s);
        } else {
            A = G = 0;
            for (int i = 0; i < n; i++) {
                if ((G + g[i])-A<=500||((G+g[i]-A)<=(A-a[i]-G))) {
                    G += g[i];
                    s[i] = 'G';
                } else {
                    A += a[i];
                    s[i] = 'A';
                }
            }
            if (Math.abs(A - G) <= 500)
                out.println(s);
            else
                bad();
        }
    }

    static boolean isCoPrime(int a, int b){
        return gcd(a,b)==1;
    }
    static int gcd(int a, int b) {
        if (a == 0)
            return b;
        while (b != 0)
            if (a > b)
                a = a - b;
            else
                b = b - a;
        return a;
    }
    static void binary(int num){
        out.println(Integer.toBinaryString(num));
    }
    static boolean equals(char a, char b){
        return a==b;
    }
    static int log2(int x){
        return (int) (Math.log(x)/Math.log(2));
    }
    static int count(char[] s, char c){
        int count = 0;
        for (int i = 0; i < s.length; i++) {
            if (s[i]==c)
                count++;
        }
        return count;
    }
    static void swap(char[] s, int a,int b){
        char temp =s[b];
        s[b]= s[a];
        s[a] = temp;
    }
    static boolean odd(int a){
        return a%2==1;
    }
    static boolean even(int a){
        return a%2==0;
    }
    static void yes(){
        out.println("YES");
    }
    static void no() {
        out.println("NO");
    }
    static void bad(){
        out.println(-1);
        out.close();
        System.exit(0);
    }
}
class CharPair{
    char ch;
    int value;
    CharPair(char c, int v){
        ch =c; value=v;
    }
    char get(){
        return ch;
    }
}
class IntPair implements Comparable<IntPair> {
    int teamID, points;

    IntPair(int teamID, int points) {
        this.teamID = teamID;
        this.points = points;
    }

    @Override
    public int compareTo(IntPair o) {
        if (teamID == o.teamID)
            return 0;
        if (points == o.points)
            return o.teamID - teamID;
        return points - o.points;
    }

    public String toString() {
        return teamID + " " + points;
    }
}
class BooleanPair {
    boolean key, value;

    BooleanPair() {
    }

    BooleanPair(boolean key, boolean value) {
        this.key = key;
        this.value = value;
    }
}
class Utilities {
    //int arrays start
    int lowerBound(int[] arr, int low, int high, int element) {
        int middle;
        while (low < high) {
            middle = low + (high - low) / 2;
            if (element > arr[middle])
                low = middle + 1;
            else
                high = middle;
        }
        if (arr[low] < element)
            return -1;
        return low;
    }

    int upperBound(int[] arr, int low, int high, int element) {
        int middle;
        while (low < high) {
            middle = low + (high - low) / 2;
            if (arr[middle] > element)
                high = middle;
            else
                low = middle + 1;
        }
        if (arr[low] <= element)
            return -1;
        return low;
    }
    //int arrays end
    //long arrays start
    int lowerBound(long[] arr, int low, int high, long element) {
        int middle;
        while (low < high) {
            middle = low + (high - low) / 2;
            if (element > arr[middle])
                low = middle + 1;
            else
                high = middle;
        }
        if (arr[low] < element)
            return -1;
        return low;
    }

    int upperBound(long[] arr, int low, int high, long element) {
        int middle;
        while (low < high) {
            middle = low + (high - low) / 2;
            if (arr[middle] > element)
                high = middle;
            else
                low = middle + 1;
        }
        if (arr[low] <= element)
            return -1;
        return low;
    }
    //long arrays end
    //double arrays start
    int lowerBound(double[] arr, int low, int high, double element) {
        int middle;
        while (low < high) {
            middle = low + (high - low) / 2;
            if (element > arr[middle])
                low = middle + 1;
            else
                high = middle;
        }
        if (arr[low] < element)
            return -1;
        return low;
    }

    int upperBound(double[] arr, int low, int high, double element) {
        int middle;
        while (low < high) {
            middle = low + (high - low) / 2;
            if (arr[middle] > element)
                high = middle;
            else
                low = middle + 1;
        }
        if (arr[low] <= element)
            return -1;
        return low;
    }
    //double arrays end
}
class Bitmasks{
    static byte andBitmask(byte state, byte... masks){
        byte temp=0;
        for (int i = 0; i < masks.length; i++) {
            temp|=masks[i];
        }
        return (byte) (state&temp);
    }
    static byte toggleBitmask(byte state ,byte... masks){
        return state;
    }
    static byte removeBitmask(byte state, byte... masks){
        return state;
    }
    static byte addBitmask(byte state ,byte... masks){
        return state;
    }
}