Hint: Prove that if $f: G_1 \to G_2$ is an isomorphism then $|x|$ divides $|f(x)|$. Therefore if $f: G_1 \to G_2$ is an isomorphism then $f: G_1 \to G_2$ and $f^{-1} : G_2 \to G_1$ are homomorphisms therefore $|x|$ divides $|f(x)|$ and $|f(x)|$ divides $|x|$, so $|x|=|f(x)|$.