# Permutation Representation

A permutation is a bijection from a set X onto itself. If X is finite, the elements of X are often numbered 1, 2, 3, ..., n. A permutation of a set with five elements is often denoted by

meaning the element 1 is mapped to the element 3 of the set, the element 2 is mapped to the element 2 and so on and so forth. Another way of denoting permutations is to use cycle notation. Cycle notation is not necessarily unique. The following cycle

(2 4 7)

means that the element 2 is mapped to the element 4, the element 4 is mapped to the element 7 and the element 7 is mapped to the element 2. The cycle above could also be written

(7 2 4)

The product of several cycles is evaluated from right to left. The above permutation can be written as

(5 3) (5 1) (5 4)

(1 3 5 4) (1)

(1) (1 3 5 4)

A permutation can be written uniquely as the product of cylces

if 0 ≤ a_i ≤ i-1 holds for each exponent a_i. The example permutation can be uniquely written as

Your task is to compute the a_i's of a given permutation.

## Input

The input consists of several test cases. Each test case consists of three lines. The first line contains the number n (1 ≤ n ≤ 200000). The second line contains the elements from 1 to n. The third line contains a mapping for every element from the second line.

## Output

For each test case there should be one line of output. Print all the a_i's on a single line separated by one space in the order a_1 ... a_n.