Taller to the Left
There are n people standing in a row, numbered from 1 to n from left to right. Person i has height h_i.
For every person i, find the nearest person to their left who is strictly taller than them. That is the largest index j with j < i and h_j > h_i. If there is no such person, the answer for i is 0.
Input
The first line contains an integer n (1 ≤ n ≤ 5·10^5), the number of people.
The second line contains n integers h_1, h_2, …, h_n (1 ≤ h_i ≤ 10^9), the heights.
Output
Print n integers separated by spaces: the i-th of them is the index of the nearest strictly taller person to the left of person i, or 0 if there is none.
Notes
In the first example, person 4 (height 4) is not blocked by person 3, who has the same height, so their answer is person 1 (height 5). Person 6 is the tallest of everyone, so their answer is 0.
Ties never count: a person of equal height is not taller.