Let $G$ be a finite abelian group, and $g_1, \ldots, g_n \in G$ such that the cyclic groups that they generate are in direct sum $\langle g_1 \rangle \oplus \ldots \oplus \langle g_n \rangle$. Is it always possible to find elements $h_1, \ldots, h_n \in G$ and integers $a_1, \ldots, a_n$ such that the following three facts hold

1) $g_i= a_i h_i$, for all $1 \leq i \leq n$,

2) the cyclic subgroups generated by the $h_i$ are in direct sum, $H:=\langle h_1 \rangle \oplus \ldots \langle h_n \rangle$.

3) $H$ is a direct summand of $G$?

(I asked this question on math.stackexchange, see https://math.stackexchange.com/questions/199928/smallest-pure-subgroup-containing-a-fixed-subgroup)