In SOME TWO-GENERATOR ONE-RELATOR NON-HOPFIAN GROUPS , the authors say that if $\pi(m) = \pi(n)$ (where $\pi(k)$ is the set of prime factors of $k \in \mathbb{N}$), then every surjective morphism $\phi: G \to G$ is an automorphism, and therefore $G$ is hopfian.
This is absolutely not obvious to me, and I can't prove it. I tried to directly tackle it by trying to prove that $\ker \phi = \{1\}$, but nothing resulted from this. Then I tried to suppose that $\phi$ is not injective and derive a contradiction, but I did not manage to use that $\pi(n) = \pi(m)$ and conclude something. I also tried to prove that, assuming $n > m$, $BS(n,n)$ is a subgroup of $BS(m,n)$ with finite index, thus by Corollary 2, $BS(m,n)$ is hopfian. But I did not even manage to prove that $BS(n,n)$ is a subgroup and I did not even try to compute the index.
Anybody has an idea on how to proceed to prove this?