a, b = map(int, input().split()) a, b = min(a, b), max(a, b) if a == 1 and b == 1: print('Q') exit() if b-a == 1: print('Q') else: print('P')