I have been asked to prove that a group of order p^2, where p is a prime, is abelian.

This is what I have tried so far.

G is a group of order p^2. Now Z be the center of G. So Z is a subgroup of G. So by Lagrange Theorem o(Z)|o(G).

So o(Z) = 1, p or p^2.

o(Z) cannot be 1 since a group whose order is a prime power has a non trivial center.

If it is p^2 then the result is true.

BUt how can I eliminate the possibility that o(Z) = p??