I was reading Arturo Magidin's answer here, which states that the localization of a UFD over a multiplicative subset not containing $0$ is still a UFD. It makes sense that a factorization into units and irreducibles exists, but I don't see uniqueness.
He says it follows by cross multiplying and using the claims. Ok, I let $a/s\in S^{-1}D$. I can factor it into irreducibles $$ \frac{a}{s}=\frac{p_1}{s_1}\cdots\frac{p_n}{s_n}=\frac{q_1}{t_1}\cdots\frac{q_m}{t_m}. $$ If I crossmultiply I get different types of terms all over the place and don't know what to compare?