You know that P and Q are just copies of X and Y, right?

so in func(), why don't you print up the values of P and Q and X and whatever else interests you.

See what these variables are all...