#include <iostream>
#include <cstdio>
using namespace std;
int main( int argc , char * argv[] ) {
int a,b,c;
scanf("%d%d%d" , &a,&b,&c);
while ( a != 0 || b != 0 || c != 0 ) {
if ( b - a == c - b ) {
printf("AP %d\n" , c + (c-b) );
}
else if ( b/a == c/b ) {
printf("GP %d\n" , c * (c/b));
}
scanf("%d%d%d" , &a,&b,&c);
}
return 0;
}
Arpit's Newsletter read by 15000+ engineers
🔥 Thrice a week, in your inbox, an essay about system design, distributed systems, microservices, programming languages internals, or a deep dive on some super-clever algorithm, or just a few tips on building highly scalable distributed systems.