I'm studying number theory on my own and now I encountered a problem I couldn't solve. Namely
Let $n\geq 1$ be an integer, and let $R$ be a unique factorization domain. Suppose that $a,b$ are coprime elements of $R$ with the property that $ab=c^n$ for some nonzero $c\in R$. Why do there are $r,s\in R$ and unit $u\in R^*$ such that $a=ur^n$ and $b=u^{-1}s^n$?
And does the same proof works in the cases $R=\mathbb Z$ and $R=\mathbb Z[i]$ as those are given separately in the book "Catalan's Conjecture"?