see non-trivial applications of fundamental theorem of finite abelian groups. to solve the problem, i'll assume that is not cyclic and i'll show that :
we have where and let for any
define by: it's easy to see that and if and only if
therefore: the only thing left to prove is that: so we define by: note that
is well-defined because it's clear that now suppose that for some then for some which is obviously nonsense!