Problem 15 of the first chapter, Groups, in Hungerford's Algebra states
Let $G$ be a nonempty finite set with an associative binary operation such that for all $a, b, c \in G$ , $ab = ac \implies b = c$ and $ba = ca \implies b =c$ . Then G is a group. Show that this conclusion may be false if $G$ is infinite.
It can be deduced from this that the inverse and the identity element are unique, but I can not understand how to attack the problem to prove $G$ may not be a group if it is infinite. How to approach the problem?