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 \cdots \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
$g_i = a_i \cdot h_i$, for all $1 \leq i \leq n$,
the cyclic subgroups generated by the $h_i$ are in direct sum, $H:=\langle h_1 \rangle \oplus \cdots \oplus \langle h_n \rangle$.
$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)