import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;


public class ANARC_2010_A_Alt
{
	BufferedReader in;
	Scanner inr;
	PrintWriter out;

	void initIO() throws IOException
	{
		inr = new Scanner(System.in);
		in = new BufferedReader(new InputStreamReader(
				System.in));
		out = new PrintWriter(new OutputStreamWriter(System.out));
	}
	
	void solve() throws Exception
	{
		while (true)
		{
			int a[] = new int[3];
			for (int i = 0; i < 3; i++)
				a[i] = nextInt();
			if (a[0] == 0 && a[1] == 0 && a[2] == 0)
				break;
			if (a[1] != 0 && a[0] != 0 && a[2] % a[1] == 0 && a[1] % a[0] == 0 && a[2] / a[1] == a[1] / a[0])
				out.println("GP " + (a[2] * (a[2] / a[1])));
			else
				out.println("AP " + (a[2] + (a[2] - a[1])));
		}
	}

	void run() throws Exception
	{
		initIO();
		solve();
		out.flush();
	}

	int nextInt()
	{
		return inr.nextInt();
	}
	
	String nextLine()
	{
		return inr.nextLine();
	}
	
	String nextString()
	{
		return inr.next();
	}

	public static void main(String[] args) throws Exception
	{
		new ANARC_2010_A_Alt().run();
	}
}
