Question
Next Taller Signal Tower

Along a highway, signal towers have different heights. For each tower, find the first tower to its right that is strictly taller. If no taller tower exists, print -1.

 

Input

The first line contains KaTeX can only parse string typed expression. For each test case, the first line contains KaTeX can only parse string typed expression. The second line contains KaTeX can only parse string typed expression integers.

Output

For each test case, print KaTeX can only parse string typed expression integers: the next greater height for each tower.

Example
Example 1:
Input
1

4
2 1 3 2
Output
3 3 -1 -1


Example 2:
Input
1

5
5 4 3 2 1
Output
-1 -1 -1 -1 -1

Online