A permutation of the integers 1 to $$n$$ is obtained by placing these numbers in a certain order. A logical way to represent permutations is thus lists. For $$n = 5$$ a permutation can, for example, be represented in the following way:

    2, 3, 4, 5, 1

However, there is another way to represent permutations: as a list of integeres, where the $$i$$-th number indicates the position of the number $$i$$ in the permutation. This second representation is called an inverse permutation. The inverse permutation of the above example is thus:

    5, 1, 2, 3, 4

because number 1 is at position 5 in the permutation, number 2 is at position 1 in the permutation, …

An ambiguous permutation is a permutation which cannot be distinguished from its inverse permutation. The permutation 1, 4, 3, 2 for example is ambiguous, because its inverse permutation is the same.

Assignment

Example

>>> inversePermutation([1, 4, 3, 2])
[1, 4, 3, 2]
>>> inversePermutation([2, 3, 4, 5, 1])
[5, 1, 2, 3, 4]
>>> inversePermutation([1]) 
[1]

>>> ambiguousPermutation([1, 4, 3, 2])
True
>>> ambiguousPermutation([2, 3, 4, 5, 1])
False
>>> ambiguousPermutation([1]) 
True