Any periodic abelian group is the direct sum of its maximal p-subgroups I have an exercise. I cannot solve. Please help me to solve it:

Prove that any periodic abelian group is the direct sum of its maximal $p$-subgroups.


Let $G$ be a periodic abelian group.
For each prime number $p$, Let $G_p$ = {$x \in G$; $p^n x = 0$ for some integer $n \geq 0$}.
It suffices to prove that $G$ is the direct sum of $G_p$, where $p$ runs through all the prime numbers. 
Let $a \in G$.
Let $n$ be its order.
Let $n = p_1^{m_1}\cdots p_r^{m_r}$ be the prime decomposition.
Let $n_i = p_1^{m_1}\cdots p_r^{m_r}/p_i^{m_i}$.
Since gcd($n_1, \dots n_r$) = 1, $n_1k_1 + \cdots n_rk_r = 1$ for some integers $k_1, \dots k_r$
Let $b_i = n_ik_ia$ for $i = 1, \dots r$.
Then $a = b_1 + \cdots + b_r$.
Since $n_ip_i^{m_i} = n$, $p_i^{m_i}b_i = 0$.
Hence $b_i \in G_{p_i}$.
Next we prove that this decomposition is unique.
It suffices to prove that if $c_1 + \cdots + c_s$ = 0, then each $c_i = 0$,
where $c_i \in G_{p_i}$ and $p_i \neq p_j$ for $i \neq j$.
Since $c_1 = -(c_2 + \cdots + c_s)$, $mc_1 = 0$ for some integer $m$ relatively prime to $p_1$. Since $c_1 \in G_{p_1}$, $c_1$ must be 0.
Similarly $c_i = 0$ for all $i$ and we are done.
