How to prove this Corollary regarding ratios of densities being sufficient

The following Corollary is used in "Theory of Point Estimation" by Lehmann to prove a theorem. However I'm unsure how to prove this Corollary (it's left as a problem, so proof is omitted). The corollary states:

A necessary and sufficient condition for a statistic $$U(X)$$ to be sufficient is that for any fixed $$\theta_1, \theta_2$$ , the ratio $$p_{\theta_1} (x)/ p_{\theta_2}(x)$$ is a function only of $$U(X)$$.

Clearly if $$U(X)$$ is sufficient, then the ratio is a function only of $$U(X)$$ as a direct result of the factorisation theorem.

However I'm not sure how to prove that $$p_{\theta_1} (x)/ p_{\theta_2}(x)$$ being a function only of $$U(X)$$ implies sufficiency. Intuitively we would expect this to be the case, also because of the factorisation theorem, but I'm not sure how I'd prove this formally.

Let $$R$$ be the support of the distribution of $$X$$, and suppose that do not depend on the parameter $$\theta$$. Fix one value of $$\theta_2$$, and let $$\theta_1$$ vary over the parameter space. Write $$p_{\theta_2}(x)= g(x)$$ (for clarity). Then we get $$p_{\theta_1}(x)=g(x) h(U(x);\theta_1)$$ for some function $$h$$, and $$g$$ (not depending on $$\theta_1$$). But that is the factorization theorem.