If $\alpha, \beta$ are the roots of the equation $ x^2 - px + q = 0 $ and $\alpha_1, \beta_1$ are the roots of the equation $x^2 - qx + p = 0$,
Form the quadratic equation whose roots are $$ \frac{1}{\alpha_1 \beta} + \frac{1}{\alpha \beta_1} and \frac{1}{\alpha_1 \alpha} + \frac{1}{\beta_1 \beta} $$
Calculation gives $$\left(\frac{1}{\alpha_1 \beta} + \frac{1}{\alpha \beta_1}\right)+\left(\frac{1}{\alpha_1 \alpha} + \frac{1}{\beta_1 \beta}\right)=\frac{(\alpha +\beta)(\alpha_1+\beta_1)}{\alpha\alpha_1\beta\beta_1}=1$$ and similarly $$\left(\frac{1}{\alpha_1 \beta} + \frac{1}{\alpha \beta_1}\right)*\left(\frac{1}{\alpha_1 \alpha} + \frac{1}{\beta_1 \beta}\right)=\frac{p^3+q^3-4pq}{(pq)^2}$$ Then the equation is $$(pq)^2X^2-(pq)^2X+p^3+q^3-4pq=0$$