A, B = gets.split.map(&:to_i) if A.odd? && (B == A || B == A + 1) puts 'Q' elsif A.even? && (B == A - 1) puts 'Q' else puts 'P' end