10300: CF EDU - DSU - Step 2 - B. Parking
[Creator : ]
Description
There are $n$ slots on a circular parking enumerated from $1$ to $n$. There are $n$ cars that want to park in the natural order. $i$-th car wants to park at $p_i$-th slot. If the car drives to a parking slot and her slot is occupied, it drives in a circular manner and parks on the first vacant slot.
Input
The first line contains integer $n\ (1≤n≤300,000)$ — the size of the parking and the number of cars.
The second line contains $n$ integers, $p_i\ (1≤p_i≤n)$ — the slot that wants to be occupied by car $i$.
Output
Output $n$ numbers. $i$-th number should be the parking slot which was occupied by $i$-th car.
Sample 1 Input
3
2 2 2
Sample 1 Output
2 3 1