I was solving a practice test for the GRE math subject test and I came across a problem which I thought was unsolvable. The solution provided in the back makes no sense to me, so I hope someone can shed some light on this situation.

Letf,g, andhbe functions of two variables that are differentiable everywhere such that wherexandyin turn are functions of u and v. We know that

, and that and that . Let and . We are also given that

The object is to find .

Now note that the partial derivatives given are evaluated at different points, but the solution is not afraid to say that

Now, it makes no sense to me that you can just pick and choose where you evaluate the partials involved in the chain rule... but that's what the solution does. Shouldn't they all be evaluated atP? Why is it allowed to evaluate some atQand some atP? Does the solution somehow implicitly make use of and which are given?

Thank you for taking the time to read my question!