$\log _{8} p=25$ and $\log _{2} q=5 \Rightarrow p=8^{25}$ and $q=2^{5}$ $\Rightarrow p=\left(2^{3}\right)^{25}$ and $q=2^{5}$. $\Rightarrow p=2^{75}$ and $q=2^{5}$ $\Rightarrow p=\left(2^{5}\right)^{15}$ and $q=2^{5}$ $\Rightarrow p=q^{15}$.
Explanation as extracted from the printed page; notation may be imperfect.