pull back and push out problem [duplicate]

If a category $K$ has pullbacks. For composable morphisms $f: A\to B$ and $g: B \to C,$ if $g$ and $f$ are extremal epimorphisms, prove that $gf$ is an extremal epimorphism.

The definition of extremal epimorphism I have been given is:

A morphism $e: A \to B$ is an extremal epimorphism when for each commutative diagram $e: A \to B,$ $f: A \to C$, $m: C \to B$ ($e= mf$) if $m$ is monic, then $m$ is an isomorphism.

I have let $f = mk$ and $g = nh$, then I have drawn out the pullbacks of $f$ and $m,$ and of $g$ and $n$.

I don't know where to go from here.

-

marked as duplicate by Najib Idrissi, AlexR, M Turgeon, Dennis Gulko, Zhen LinDec 13 '13 at 21:39

Let $h:A\to X$ be any morphism and $m:X\to C$ monic such that $mh=gf$. We want to show that $m$ is an isomorphism.
Let $P$ be the pullback of the diagram $g:B\to C$ and $m:X\to C$. By the universal property of pullbacks there exists a map $\alpha:A\to P$. Denote by $m':P\to B$ and $g':P\to X$ the induced morphisms. Now $m'$ is monic as the pullback of a monic morphism.
Because $f$ is an extremal epi, $m'$ is an iso. Hence we have a morphism $g'm'^{-1}:B\to X$. Because $g$ is an extremal epi, $m$ is an iso.
Edit: The fact that $m'$ is monic is not entirely trivial. Maybe you want to show this yourself.