A,B = map(int,input().split()) if A % 2 == 1 and (B==A+1 or B==A): print('Q') elif A % 2 == 0 and (B==A-1): print('Q') else: print('P')