Statement: If $p$ is a prime number, $G$ is a group with $|G| = p^n$, show that $Z(G)$ is non-trivial group (Hint: Show that $p$ divides $|Z(G)|$).
Comments: I know the logic behind class equation, so it says $$|G| = |Z(G)|+[G:Z(a_1)]+...+[G:Z(a_k)]$$ where $a_1,...,a_k$ are elements chosen from conjugacy classes $\bar{a_1}, ..., \bar{a_k}$ where these conjugacy classes have more than one element. Using that, I thought I could prove the statement by contradiction.
Proof: Suppose for a contradiction that $Z(G)$ is trivial group, i.e., $|Z(G)| = 1$. Then we can't have $[G:Z(a_i)] = 1$ for $1 \le i \le k$ because $[G:Z(a_i)] = 1$ means that $a_i$ has one elements in its conjugacy class. But if that was the case, than it would be included in $|Z(G)|$ but we know that $|Z(G)| = 1$ and $Z(G) = \{e\}$ if we say more precisely.
So $[G:Z(a_i)] > 1$ and since $[G:Z(a_i)]$ is an index $[G:Z(a_i)]$ divides $|G|$, we can say $[G:Z(a_i)] \ge p$ for all $i$ or $[G:Z(a_i)] \in \{p,p^2,...,p^n\}$ more precisely.
After this, I could not find a way to continue the proof. Maybe proof by contradiction was not a good idea from the start. Could anyone tell me how can I use the hint given in question? Any help will be appreciated. Thank you in advance.