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