#CCBCHBAHAI0000086. Build Array from Permutation

Build Array from Permutation

Build Array from Permutation

Source: LeetCode

Version: Phuoc Hung OJ Extended

Problem

You are given a zero-based permutation a0,a1,…,an−1a_0,a_1,\ldots,a_{n-1} of {0,1,…,n−1}\{0,1,\ldots,n-1\}.

Construct an array bb of length nn such that for every 0≤i<n0\le i<n,

bi=aai.\boxed{b_i=a_{a_i}}.

Because aa is a permutation, every aia_i is a valid index of aa.

Input

The first line contains nn. The second line contains a permutation a0,a1,…,an−1a_0,a_1,\ldots,a_{n-1} of 0..n−10..n-1.

Output

Print b0,b1,…,bn−1b_0,b_1,\ldots,b_{n-1} on one line.

Subtask

Subtask 1 (20 points): 1≤n≤101\le n\le 10.

Subtask 2 (30 points): 1≤n≤1001\le n\le 100.

Subtask 3 (50 points): 1≤n≤10001\le n\le 1000.

Example

Input

6
0 2 1 5 3 4

Output

0 1 2 4 5 3

Explanation

The result follows directly from the mathematical definition above.