Solution (source code)

= Solution

If $G$ is generated by $d$ elements, a homomorphism $G\to Q$ is determined by the images of those generators. There are at most $|Q|^d$ such choices, so only finitely many homomorphisms exist.