Just a quick comment about the group theory. To show the product of two permutations is another permutation, just write in terms of transpositions and since the product of a string of transpositions is still a string of transpositions, you immediately have this rule holds. For the rearrangement theorem, the proof is by contradiction. Assume two permutations in the list are the same, so P_alpha Pi=P_alpha Pj for i not equal to j. Then by multiplying from the left by the adjoint of P_alpha, you immediately see that you must have Pi=Pj. But that is not true if i is not equal to j, so no two elements in the list can be the same.
nicee
@cedricqi6092