Hint: Let the roots of $ p(x) = 0 $ be $\alpha, \beta$.
What can you say are the values of $ q(10), q(20), q(23) $?
They are either $ \alpha$ or $\beta$. Note that at most two of them have the same value, since $q(x)$ is a quadratic function.
Hence, can you conclude what the possibilities of the last root is? (Note, there is more than 1 possibility)
We split into casework, depending on what values they are.
Case 1: $q(10) = \alpha, q (20) = \beta , q (23) = \alpha $. The last solution is $r$ and satisfies $ q(r) = \beta$.
Observe that for any constant $C$, the solutions to $q(x) = C$ sum up to the same value by Vieta's formula. Hence, we have $ 10 + 23 = 20 + r$, which gives $r = 13$.
Complete the rest of the cases.