By Lemma \ref{lemma-recurring-symmetric-real} the rank of $A$ is $n - 1$. The composition $$ \mathbf{Z}^{\oplus n} \xrightarrow{\text{diag}(m_1, \ldots, m_n)} \mathbf{Z}^{\oplus n} \xrightarrow{(a_{ij})} \mathbf{Z}^{\oplus n} \xrightarrow{\text{diag}(m_1, \ldots, m_n)} \mathbf{Z}^{\oplus n} $$ has matrix $a_{ij}m_im_j$. Since the cokernel of the first and last maps are torsion of order prime to $\ell$ by our restriction on $\ell$ we see that it suffices to prove the lemma for the matrix with entries $a_{ij}m_im_j$. Thus we may assume $m = (1, \ldots, 1)$. \medskip\noindent Assume $m = (1, \ldots, 1)$. Set $V = \{1, \ldots, n\}$ and $E = \{(i, j) \mid i < j\text{ and }a_{ij} > 0\}$. For $e = (i, j) \in E$ set $a_e = a_{ij}$. Define maps $s, t : E \to V$ by setting $s(i, j) = i$ and $t(i, j) = j$. Set $\mathbf{Z}(V) = \bigoplus_{i \in V} \mathbf{Z}i$ and $\mathbf{Z}(E) = \bigoplus_{e \in E} \mathbf{Z}e$. We define symmetric positive definite integer valued pairings on $\mathbf{Z}(V)$ and $\mathbf{Z}(E)$ by setting $$ \langle i, i \rangle = 1\text{ for }i \in V, \quad \langle e, e \rangle = a_e\text{ for }e \in E $$ and all other pairings zero. Consider the maps $$ \text{d} : \mathbf{Z}(V) \to \mathbf{Z}(E), \quad i \longmapsto \sum\nolimits_{e \in E,\ s(e) = i} e - \sum\nolimits_{e \in E,\ t(e) = i} e $$ and $$ \text{d}^*(e) = a_e(s(e) - t(e)) $$ A computation shows that $$ \langle d(x), y\rangle = \langle x, \text{d}^*(y) \rangle $$ in other words, $\text{d}$ and $\text{d}^*$ are adjoint. Next we compute \begin{align*} \text{d}^*\text{d}(i) & =  \text{d}^*( \sum\nolimits_{e \in E,\ s(e) = i} e - \sum\nolimits_{e \in E,\ t(e) = i} e) \\ & = \sum\nolimits_{e \in E,\ s(e) = i} a_e(s(e) - t(e)) - \sum\nolimits_{e \in E,\ t(e) = i} a_e(s(e) - t(e)) \end{align*} The coefficient of $i$ in $\text{d}^*\text{d}(i)$ is $$ \sum\nolimits_{e \in E,\ s(e) = i} a_e + \sum\nolimits_{e \in E,\ t(e) = i} a_e = - a_{ii} $$ because $\sum_j a_{ij} = 0$ and the coefficient of $j \not = i$ in $\text{d}^*\text{d}(i)$ is $-a_{ij}$. Hence $\Coker(A) = \Coker(\text{d}^*\text{d})$. \medskip\noindent Consider the inclusion $$ \Im(\text{d}) \oplus \Ker(\text{d}^*) \subset \mathbf{Z}(E) $$ The left hand side is an orthogonal direct sum. Clearly $\mathbf{Z}(E)/\Ker(\text{d}^*)$ is torsion free. We claim $\mathbf{Z}(E)/\Im(\text{d})$ is torsion free as well. Namely, say $x = \sum x_e e \in \mathbf{Z}(E)$ and $a > 1$ are such that $ax = \text{d}y$ for some $y = \sum y_i i \in \mathbf{Z}(V)$. Then $a x_e = y_{s(e)} - y_{t(e)}$. By property (2) we conclude that all $y_i$ have the same congruence class modulo $a$. Hence we can write $y = a y' + (y_1, y_1, \ldots, y_1)$. Since $\text{d}(y_1, y_1, \ldots, y_1) = 0$ we conclude that $x = \text{d}(y')$ which is what we had to show. \medskip\noindent Hence we may apply Lemma \ref{lemma-orthogonal-direct-sum} to get injective maps $$ \Im(\text{d})^\#/\Im(\text{d}) \leftarrow \mathbf{Z}(E)/(\Im(\text{d}) \oplus \Ker(\text{d}^*)) \rightarrow \Ker(\text{d}^*)^\#/\Ker(\text{d}^*) $$ whose cokernels are annihilated by the product of the $a_e$ (which is prime to $\ell$). Since $\Ker(\text{d}^*)$ is a lattice of rank $1 - n + e$ we see that the proof is complete if we prove that there exists an isomorphism $$ \Phi : M_{torsion} \longrightarrow \Im(\text{d})^\#/\Im(\text{d}) $$ This is proved in Lemma \ref{lemma-coker}.