I'm having trouble understanding the proof of Lemma B.1.3.2 in Johnstone's Sketches of an Elephant. Let $\mathbb{C}:\mathcal{S}^{\mathrm{op}} \to \mathbf{Cat}$ be an indexed category, and denote by $\Pi: \mathcal{G}(\mathbb{C}) \to \mathbb{C}$ the associated Grothendieck fibration. For any morphism $(f,x): (I,A) \to (J,B)$ in $\mathcal{G}(\mathbb{C})$ the vertical part is defined to be $f$. Then Lemma 1.3.2 reads:
Lemma 1.3.2 Let $h: U \to V$ be a morphism of $\mathcal{G}(\mathbb{C})$. Then the vertical part of the factorisation of $h$ is an isomorphism iff, given any morphism $k: W \to V$ with the same codomain and factorisation $\Pi(k) = \Pi(h) \circ x$ of $\Pi(x)$ through $\Pi(h)$, there is a unique $l: W \to U$ in $\mathcal{G}(\mathbb{C})$ with $\Pi(l) = x$ and $hl = k$.
If the vertical part of $h$ is an isomorphism, then it is clear that the factorisation property holds.
Conversely, assuming the factorisation property, we write $h = (y,f)$, and set $k = (y,\mathrm{id})$, as suggested in the Elephant; as $x = \mathrm{id}$, we get $\Pi(k) = \Pi(h) \circ x$, so that there exists a unique morphism $g$ such that for $l = (\mathrm{id}, g)$ we get $hl = k$. Unwinding $hl = k$ we see that the composition of $y^*(B) \xrightarrow{g} \mathrm{id}^*(A) \xrightarrow{\mathrm{id}^*(f)} \mathrm{id}^* \circ y^*(B) \xrightarrow{\theta_{\mathrm{id},y}} y^*(B)$ is equal to the identity. Thus $f$ has right inverse because $\mathrm{id}^*(f)$ has one, but for the life of me I'm not able to verify that $f$ also has a left inverse. So my question is:
Why does $f$ have a left inverse?
Claim: The morphism $g$ is prone (usually called Cartesian).
Proof: Both $h$ and $k$ are prone (as pointed out by Pece), so that $l$ must also be prone (see e.g. Prop. 3.4 in Vistoli's notes on stacks).
Corollary: The morphism $f$ is an isomorphism.
Proof: We already know that $g$ has a left inverse, namely $\mathrm{id}^*(f) \circ \theta_{\mathrm{id},y}$, and we have shown in the above discussion that prone morphisms have a right inverse, so that $g$ is an isomorphism. As isomorphisms satisfy the "2-out-of-3" property, we know that $\mathrm{id}^*(f)$ is an isomorphism, and therefore also $f$.