LearnPy Hub
← Arena
IntermediateRating 1300

Next Smaller to the Right

For each number, print the first number to its right that is smaller, or -1.

Input

n, then n integers.

Output

n integers.

Sample 1

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

Sample 2

Input
3
1 2 3
Output
-1 -1 -1
solution.py
Output appears here
Next Smaller to the Right · Python Arena problem · LearnPy Hub