If $f: V \to W$ is a surjective homomorphism of vector spaces, and we have fixed a basis for $V$, it is always possible to find a basis for $W$ such that the matrix associated to $\phi$ in the two bases is triangular with ones on the "diagonal" (what I mean with this is explained more precisely later, in the case of abelian groups), up to possibly permuting the chosen basis of $V$. This motivates the following question, in the realm of finite abelian groups.

Let $H$ be a finite abelian group with a fixed basis $h_1, \ldots, h_n$, with "basis" here we mean elements that satisfy the property $\langle h_1 \rangle \oplus \ldots \oplus \langle h_n \rangle=H$. Let $\phi:H \to G$ be a homomorphism of finite abelian groups. Let us assume that $\phi$ is surjective, so $\phi(h_1), \ldots, \phi(h_n)$ generate $G$.

Is it possible to find a basis for $G$, and a permutation of the elements $h_1, \ldots, h_n$, such that the matrix associated with $\phi$ in the two given basis has a triangular form with $1$ on the diagonal?

More precisely, can we find a basis $g_1, \ldots, g_m$ for $G$, with $m \leq n$, and a permutation $\sigma \in \mathfrak{S}_n$ such that we can write

$\phi(h_{\sigma(i)}) = a_{i,1} g_1 + \ldots+ a_{i,m} g_m$

with $a_{i,j}=0$ when $j>i$, and $a_{i,i}=1$?

(I asked a similar question on math.stackexchange, but I spelled it differently and in a silly/wrong way so that the answer in that case was trivial)