char s[];main(f,g){f=read(0,s)-1;g=s[f-2]^s[f-1]^8;write(1,s,f-2*!g);puts("-AI"+!g);}