a,b=map(int,input().split()) if (a&1) and (b==a or b==a+1): print('Q') elif (a&~1) and (b==a-1): print('Q') else: print('P')