A function $g$ from a set X to itself satisfies $g ^ { m } = g ^ { n }$ for positive integers $m$ and $n$ with $m > n$. Here $g ^ { n }$ stands for $g \circ g \circ \cdots \circ g$ ( $n$ times). Show that $g$ is one-to-one if and only if $g$ is onto.