Let $S,\star$ be an associative binary structure with identity $e$. Assume that for every $s\in S$ there is an integer $n_s>0$ such that $s^{n_s}=e$. Show that $S,\star$ is a group.
I am not sure what to do for this problem. Any feedback would be appreciated.