#include<stdio.h>
int main() {
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
while(a!=0 || b!=0 || c!=0)
{
if(a>=b && a-b==b-c) //Decreasing AP
{
printf("AP ");
printf("%d\n",c+(a-b));
}
if (a<b && b-a==c-b) //Increasing AP
{
printf("AP ");
printf("%d\n",c+(b-a));
}
else
{
int r;
if(a>b)
{
if(b!=0) r=a/b;
else if(c!=0)
r=b/c;
printf("GP ");
printf("%d\n",c/(r));
}
else if(a<b)
{
if(a!=0)
r=b/a;
else if(b!=0)
r=c/b;
printf("GP ");
printf("%d\n",a*(r*r*r));
}
}
scanf("%lld%lld%lld",&a,&b,&c);
}
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KaW50IG1haW4oKSB7CglpbnQgYSxiLGM7CglzY2FuZigiJWQlZCVkIiwmYSwmYiwmYyk7Cgl3aGlsZShhIT0wIHx8IGIhPTAgfHwgYyE9MCkKCXsKCWlmKGE+PWIgJiYgYS1iPT1iLWMpIC8vRGVjcmVhc2luZyBBUAoJewoJcHJpbnRmKCJBUCAiKTsKCXByaW50ZigiJWRcbiIsYysoYS1iKSk7Cgl9CglpZiAoYTxiICYmIGItYT09Yy1iKSAvL0luY3JlYXNpbmcgQVAKCXsKCXByaW50ZigiQVAgIik7CglwcmludGYoIiVkXG4iLGMrKGItYSkpOwoJfQkKCWVsc2UKCXsKCQlpbnQgcjsKCSAgICBpZihhPmIpCgkgICAgewoJCSAgICBpZihiIT0wKSByPWEvYjsKCSAgICAJZWxzZSBpZihjIT0wKQoJICAgIAlyPWIvYzsKCSAgICAJcHJpbnRmKCJHUCAiKTsKCSAgICAJcHJpbnRmKCIlZFxuIixjLyhyKSk7CgkgICAgfQoJCSBlbHNlIGlmKGE8YikKCQkgewoJCSAJaWYoYSE9MCkKCQkJcj1iL2E7CgkJCWVsc2UgaWYoYiE9MCkKCQkJcj1jL2I7CgkJCXByaW50ZigiR1AgIik7CgkJCXByaW50ZigiJWRcbiIsYSoocipyKnIpKTsKCQkgfQoJfQoJc2NhbmYoIiVsbGQlbGxkJWxsZCIsJmEsJmIsJmMpOwoJfQoJcmV0dXJuIDA7Cn0=