I need to show if $|G|=p^2$, then either $G\cong \mathbb{Z}_{p^2}$ or $G\cong \mathbb{Z}_{p} \times \mathbb{Z}_{p}$.
Let $x$ be any element in $G$. Then $o(x)$ divides $p^2$. There are three possible cases: either $o(x)=1$, or $o(x)=p$ or $o(x)=p^2$. If $o(x)=1$, then $x=e$. Now, if $o(x)=p^2$, then $G=\langle x \rangle$, thus $G \cong \mathbb{Z}_{p^2}$.
And now this is part where I get stuck. If $o(x)=p$ then every element in the group has an order $p$. Let $a,b \in G$ with $a,b \ne e$ and $b$ is not a power of $a$. Now I need to show $\langle a \rangle \cap \langle b \rangle = \{ e \}$. Suppose $x\in \langle a \rangle \cap \langle b \rangle $. Then $x=a^m$ and $x=b^n$ for some integers $m,n$. Thus, $a^m=b^n$. I'm stuck here. How do I show that the previous condition forces $x$ to be the identity? I can prove the rest if this holds true.
Also, I know that if $|G|=p^2$ then $G$ is abelian.