Suppose that $f: A \rightarrow B$ is epic in Sets. One can construct a section $s: B \rightarrow A$ of $f$ as follow: Let us define an equivalence relation $R$ on $A$ as follow: $aRa'$ iff $a, a' \in f^{-1}(b)$. This relation is clearly reflexive (because $f$ is surjective), symmetric, and transitive.
Thus, one can define the projection $\pi: A \rightarrow A/R$ and an injection $i: A/R \rightarrow A$ like $i([a]) = a$. Now, one can easily define a map $g: B \rightarrow A/R$ as $g(b) = f^{-1}(b)$.
Clearly, for $s = i \circ g$, one has $f \circ s = Id_B$.
I don't understand why axiom of choice is necessarily needed to define the injection map. Does this mean that the above construction fails without AC? Can someone explain me why and how is axiom of choice used to define $i$ ?