using System; using System.Collections.Generic; using static System.Console; using System.Linq; class yuki302 { static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static void Main() { var cin = NList; Array.Sort(cin); WriteLine(cin[1] % 2 == 0 && cin[1] - cin[0] == 1 ? "Q" : "P"); } }