A, B = map(int, input().split()) A, B = min(A, B), max(A, B) if A == 1: if B == 1: print('Q') elif B % 2 == 0: print('P') else: print('Q') elif A == 2: if B == 2: print('P') elif B == 3: print('P') elif B % 2 == 0: print('Q') else: print('P') elif A == 3: if B == 3: print('Q') else: print('P') else: print('P')