I am studying the counterpart of the axiom of choice in ETCS which is that "Every surjective fucntion has a right inverse". I am trying to see why it implies the axiom of choice and this is the paragraph i am studying at the moment.
Let $f: X \rightarrow Y$ be the surjective function and $g: Y \rightarrow X$ be the right inverse. Noticing that a surjective function represents a non empty set of a disjoint non empty set and that disjoint sets are $f^{-1}(y)$ for each $y$ in $Y$. Then $g: Y \rightarrow X$ is a choice for every $y$ in $Y$ as $g$ picks out one element of $f^{-1}(y)$. Therefore, the existence of $g$ is equivalent to the axiom of choice.
I can't make sense of the "$g: Y \rightarrow X$ is a choice for every $y$ in $Y$ as $g$ picks out one element of $f^{-1}(y)$".
I studied the definition of the axiom of choice as "given a non empty set $A$, it is possible to choose an element from each subset $a$ in set $A$"
I would greatly appreciate any help with this.