Let $X,Y,Z$ and $W$ sets, $f:X \to Y$, $g:Y \to Z$ and $h:Z \to W$ functions. If $g \circ f$ and $h \circ g$ are bijective, then $f,g$ and $h$ are bijective.
My attemp of proof goes as follows: As $g \circ f$ and $h \circ g$ are both injective and surjective, then $f$ and $g$ are injective, $g$ and $h$ are surjective. So $g$ is bijective. How do I prove that $f$ is surjetive and $h$ is injective in order to show that $f$ and $h$ are also bijective?