The conditions suggested in the question give you two equations which you can solve to find p' and q'. Use the same formulation to give (p'',q'').