ciclic groups and permutations that preserve associativity



A multiplication table of a cyclic group C (or any groupoid) can be
viewed as a set of triples <x,y,z> saying that xy =z.

Consider now a permutation on the group set f: C -->C and the triples
describing
a new table:

< f(x) , f(y) , z >

Question: what are the necessary conditions that f must
satisfy, so that the obteined table preserves associativity?
And unity? Sure, if the function is a group isomorphism
these exigences are easily satisfied. But It would be interesting
to consider weaker conditions.

Ex: Consider the following exemple, just an exemple (not necessarily
an interesting case)

+ 0 1 2 3
0 0 1 2 3
1 1 2 3 0
2 2 3 0 1
3 3 0 1 3

and after some permutation:

+ 0 2 1 3
0 0 1 2 3
2 1 2 3 0
1 2 3 0 1
3 3 0 1 3

or rearranging it

+ 0 1 2 3
0 0 2 1 3
1 2 0 3 1
2 1 3 2 0
3 3 1 0 3

.