A, B = map(int, input().split()) d = abs(A - B) print('Q' if d <= 1 else 'P')