13908 - Finding Electric God   

Description

In NTHU CS, everyone has their own programming value, whenever a student encounters problem they can't solve, he/she intends to approach his/her "electric god" for assistance, whose programming value is strictly larger than him/her, instead of doing research online. 

One day, all students in NTHU CS sit in one line, and they can only ask those who sit in their left side. Since no CS student have the ability to walk for a long distance, they will ask the electric god who sits in their nearest left. If everyone in your left side's programming value is less than yours, don't worry, Stiff Waist Beast always be with you. Stiff Waist Beast's programming value is so large that you can never imagine, and he will always sit in the 0 position to help you out!

For each person, please tell them the position of the closest electric god who sits in their left.

Input

The first line contains an integer N, and the second line contains N integer x1 to xN.

0 <= xi <= 1e9.

For testcase 1~3: 1 <= N <= 1e3.

For testcase 4~6:1 <= N <= 2e5.

Output

For each person, please tell them the position of the closest electric god who sits in their left.

Please output a space after each number and output '\n' in the end.

Sample Input  Download

Sample Output  Download

Tags

Stiff Waist Beast



Discuss