Prove or disprove the following statement: Function $f: S \rightarrow S$, where $S$ is non-empty, is bijective if and only if there exist unique functions $g, h : S \rightarrow S$ such that $$ f \circ g = f ~~~~ \text{and} ~~~~ h \circ f = f$$
Since this is a logical equivalence I need to prove both implications.
$A$ is that $f$ is bijective. $B$ that $g$ and $h$ are unique.
If I assume that $g$ and $h$ aren't unique I can use the inverse of $f$ to easily show the contradiction. How to prove $B \implies A$?