TITLE: Free products of cyclic groups
QUESTION [6 upvotes]: Given $G$, $H$, $G'$, and $H'$ are cyclic groups of orders $m$, $n$, $m'$, and $n'$ respectively. 
If $G*H$ is isomorphic to $G'* H'$, I would like to show that either $m = m'$ and $n = n'$ or else $m = n'$ and $n = m'$ holds. Where * denotes the free product.
My approach:
$G*H$ has an element of order $n$, thus $G' * H'$ has one too.
But already the next step is not clear to me, should I show that there is an element of length $> 1$ which has infinite order or what would be the right approach here?
Thank you.

REPLY [3 votes]: Let me give you an alternative argument for the claim $m=m'$ in Arturo Magidin's answer. 
Take the abelianizations of the groups $G*H$ and $G'*H'$, since $G,G,H,H'$ are abelian, their abelianizations are $G\oplus H$ and $G'\oplus H'$ respectively. Then you get $G\oplus H\cong G'\oplus H'$ and in particular, their orders $mn=m'n'$ are equal. Since we already had $n=n'$, we conclude that $m=m'$.