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