#include <stdio.h>
#include <stdlib.h>

int main()
{
	int A, B;
	scanf("%d %d", &A, &B);
	if (A + B == 0 || (A % 2 != 0 && A == B) || (A % 2 != 0 && A == B - 1) || (A % 2 == 0 && A == B + 1)) printf("Q\n");
	else printf("P\n");
	fflush(stdout);
	return 0;
}