#K59292. Reorder Sequence Based on Positions

    ID: 30832 Type: Default 1000ms 256MiB

Reorder Sequence Based on Positions

Reorder Sequence Based on Positions

You are given an integer (n) and an array of (n) integers representing positions. Your task is to reorder the sequence of numbers from 1 to (n) such that each number (i) is placed at the position specified by the (i)-th element in the positions array. Formally, for each index (i) (starting from 1), the number (i) should be placed in position (positions[i-1]).

For example, if (n=5) and the positions array is [4, 1, 3, 2, 5], then the reordered sequence is [2, 4, 3, 1, 5].

Note: All positions are 1-indexed.

inputFormat

Input is given as follows:

The first line contains an integer (n) indicating the number of entries.
The second line contains (n) space-separated integers representing the positions.

outputFormat

Output the reordered sequence in one line as space-separated integers.## sample

5
4 1 3 2 5
2 4 3 1 5