Solution (source code)

= Solution
{c}

If $T$ is a surjective <group homomorphism>, then $G=T(G)$, which is an <abelian group> by the preceding part.

If $T$ is an injective <group homomorphism>, then for all $a,b\in G$,
$$
T(ab)=T(a)T(b)=T(b)T(a)=T(ba),
$$
because $T(a),T(b)$ lie in the <abelian group> $T(G)$. Injectivity gives $ab=ba$. Hence $\boxed{G\text{ is abelian in either case}}$.