Each Christmas holidays, n friends meet to celebrate a tradition.
There are n useless presents, which are called pongos.
The pongos are wrapped up with newspaper,
so at the beginning of the game
the only available information for each pongo i is a_{i}:
how cool i seems while it is wrapped up.
Let r_{i} be the real coolness of i.
This real coolness is only known when the pongo is unwrapped.
The higher the value of a_{i},
the cooler the pongo looks when wrapped.
The higher r_{i}, the cooler it is when unwrapped.

The game goes as follows.
The participants are numbered from 0 to n−1.
At the beginning of the j-th round (from 0 to n−1),
each of the first j participants has an unwrapped pongo at his hands,
which is seen by everybody.
The round starts with the participant number j.
He always takes the pongo that looks or is coolest according to the available information:
if the pongo is still unchosen and therefore wrapped up, he uses a_{i},
and if the pongo is already on some participant’s hands, he uses r_{i}.

If a participant takes a wrapped pongo, he unwraps it and the game goes to the next round. If he takes a pongo from another participant, the participant that just lost his pongo takes the pongo that is or looks coolest among those that have not been chosen in the current round. The round continues like this until someone takes a wrapped pongo and unwraps it.

This game is deterministic. Can you tell the real coolness of the pongo that every person has at the end of the game?

Input

Input consists of several cases.
Every case starts with n,
followed by the n integers a_{i},
followed by the n integers r_{i}.
You can assume 1 ≤ n ≤ 10^{4}.
All the values for a_{i} and r_{i} are distinct integers between 0 and 2n−1.

Output

For every case,
print the n integers r_{j},
where r_{j} is the real coolness
of the pongo at the hands of the j-th person at the end of the game.

Public test cases

**Input**

3 1 0 2 5 4 3 6 3 9 7 1 2 11 10 4 6 5 8 0 5 0 1 2 3 4 9 8 7 6 5

**Output**

3 4 5 0 4 6 5 8 10 7 5 9 6 8

Information

- Author
- Cesc Folch Aldehuelo
- Language
- English
- Official solutions
- C++
- User solutions
- C++