A,B = map(int,input().split()) X = A^B if bin(X).count('0') == 1: print('Q') else: print('P')