$$\require{AMScd} \begin{CD} 0 @>>> A @>\alpha>> P @>\beta>> B @>>> 0 \\\ @. @VfVV \\\ 0 @>>> C @>\gamma>> Q @>\delta>> D @>>> 0 \end{CD} $$ Since $Q$ is injective, there exists $g\colon P\to Q$ such that $g\alpha=\gamma f$: \begin{CD} 0 @>>> A @>\alpha>> P @>\beta>> B @>>> 0 \\\ @. @VfVV @VgVV \\\ 0 @>>> C @>\gamma>> Q @>\delta>> D @>>> 0 \end{CD} Now $\delta g\alpha=\delta\gamma f=0$, so there exists $h\colon B\to D$ such that $h\beta=\delta g$ (homomorphism theorem): \begin{CD} 0 @>>> A @>\alpha>> P @>\beta>> B @>>> 0 \\\ @. @VfVV @VgVV @VhVV \\\ 0 @>>> C @>\gamma>> Q @>\delta>> D @>>> 0 \end{CD} By assumption, $h=0$, so also $\delta g=0$, which implies the image of $g$ is contained in the kernel of $\delta$, which is the same as the image of $\gamma$.