// Arup Guha
// 9/20/2013
// Solution to 2010 Arab Programming Contest Problem A: What's Next?
import java.util.*;

public class a {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);

		int[] terms = new int[3];
		for (int i=0; i<3; i++)
			terms[i] = stdin.nextInt();

		// Process all cases.
		while (terms[0] != 0 || terms[1] != 0) {

			// Input restrictions are such that these two are unique, so check AP, which is easy.
			if (terms[1] - terms[0] == terms[2] - terms[1])
				System.out.println("AP "+(terms[2] + terms[1] - terms[0]));
			else
				System.out.println("GP "+(terms[2]*(terms[1]/terms[0])));

			// Get next case.
			for (int i=0; i<3; i++)
				terms[i] = stdin.nextInt();
		}
	}
}