0

Undo the Fundamental Transformation on permutations code-golf
A permutation like
[3, 5, 1, 4, 5, 6]
1->3, 2->5, 3->1, 4->2, 5->4, 6->6
can be written as a union of cycles:
(31)(542)(6)
There's many ways to write these cycles, but we fix a canonical form by requiring that:
In each cycle...