#K79097. Permutation Transformation

    ID: 35232 Type: Default 1000ms 256MiB

Permutation Transformation

Permutation Transformation

Luka is experimenting with permutations. A permutation of length \(n\) is an array containing each number from \(1\) to \(n\) exactly once. Given a permutation \(P\) (indexed from 1), define a new array \(Q\) of the same length such that:

[ Q_i = P[P_i] \quad \text{for } 1 \leq i \leq n ]

Your task is to compute and output the array \(Q\) given the permutation \(P\).

Example:

Input:
5
2 3 1 5 4

Output: 3 1 2 4 5

</p>

inputFormat

The first line contains an integer \(n\) (the length of the permutation). The second line contains \(n\) space-separated integers representing the permutation \(P\). It is guaranteed that \(P\) is a permutation of \(\{1, 2, \ldots, n\}\).

outputFormat

Output \(n\) space-separated integers representing the resulting permutation \(Q\) defined by \(Q_i = P[P_i]\) for \(1 \leq i \leq n\).

## sample
5
2 3 1 5 4
3 1 2 4 5