LearnPy Hub
← Arena
IntermediateRating 1400

Next Greater

For each element print the first element to its right that is greater, or -1.

Input

n, then n integers.

Output

One line.

Sample 1

Input
4
4 5 2 25
Output
5 25 25 -1

Sample 2

Input
3
13 7 6
Output
-1 -1 -1
solution.py
Output appears here
Next Greater · Python Arena problem · LearnPy Hub