The question is about Corollary 1.6.2 (b) in the book by Laumon and Moret-Bailly on algebraic stacks.

There we have a scheme $S$ and morphisms $X \xrightarrow{f} Y \xrightarrow{g} Z$ of sheaves on a (version of) the big etale site of $S$. The goal is to prove that if $g \circ f$ and $Y \times_Z Y \rightarrow Y \times_S Y$ are representable by algebraic spaces, then $f$ is also representable by algebraic spaces. The proof proceeds by taking a test morphism $y\colon U \rightarrow Y$ from an $S$-scheme $U$ and observing that the diagram with top row $$X \times_Y U \rightarrow X \times_Z U$$ and bottom row $$Y\times_Z Y \rightarrow Y \times_S Y$$ is Cartesian (sorry, I don't know how to draw commutative diagrams here). I can't understand why this diagram is Cartesian: it seems that the bottom row doesn't capture the condition that the "elements" of $X$ and $U$ should have equal images in $Y$. It seems that the diagram would be Cartesian if the bottom row were $$ Y \rightarrow Y\times_Z Y$$ instead. I would be extremely grateful if someone could clarify my confusion and explain the proof of the cited Corollary.