H. Give Me This Pizza
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Today Abdalrahman and Ali have one hour break, so they decided to spend it in the Innovation Programming Lab to invent new game.

After a deep thinking they invented a new game that is played using an array a. The goal of the game is to find for each value in the array the nearest larger value to it from the right. (i.e. for the ith value in the array, the goal is to find the value in the nearest jth index, such that (1  ≤  i  <  j  ≤  n) and (aj  >  ai)). If the nearest larger value does not exist, then the answer is "-1".

Abdalrahman and Ali thought that this game is very hard and no one can solve it, so they wrote it in the white board inside the lab, and under it they wrote the following statement: "If you solve this game correctly we will give you a very big pizza".

Yosef enter the lab after Abdalrahman and Ali left it. When he saw the game, he decided to solve it to take the pizza. Yosef is very hungry currently so you decided to help him to solve the game as soon as possible. Can you?

Input

The first line contains an integer n (1  ≤  n  ≤  105), where n is the length of the array a.

The second line contains n integers a1, a2, ..., an (1  ≤  ai  ≤  50), giving the array a.

Output

Print n integers b1, b2, ..., bn, where bi is the nearest larger value for the ith value in array a. If such value does not, then bi must be "-1" (without quotes).

Examples
Input
5
2 1 3 9 4
Output
3 3 9 -1 -1
Input
7
5 9 7 3 2 1 4
Output
9 -1 -1 4 4 4 -1