Soldiers Row#10762

Soldiers Row

1 second
128 megabytes
Easy

Suppose there is a row of soldiers, identified by indices between to n-1. They are all lined up in such a way that each soldier can see only the soldiers with indices between to i-1. We say that a soldier has clear visibility if he is at least as tall as all of those in front of him. If he doesn't have clear visibility, it means that at least one of the others in front of him is taller.

We are interested in determining, for each soldier, whether he has clear visibility. If not, we want to identify the closest previous soldier who is taller than him.

Input

The first line contains the number of soldiers n~(1 \le n \le 10^5). The second line contains the heights of soldiers.

Output

Print integers. The -th integer must contain the number of the closest previous soldier who is taller than the -th soldier. If the -th soldier has clear visibility, print .

Examples

Example 1

Loading
Loading