After his leave from DMOJ, Wesley is very angry and demands you to construct an array
- There are
elements before index that are strictly smaller than - There are
elements after index that are strictly smaller than - There are
elements before index that are strictly greater than - There are
elements after index that are strictly greater than
Luckily, Wesley is a kind person and will allow for your array to violate at most
Note: We say that array
Constraints
Subtask 1 [12%]
Subtask 2 [23%]
Subtask 3 [43%]
Subtask 4 [22%]
No additional constraints.
Input Specification
The first line contains a single integer
The next line contains
The next line contains
The next line contains
The next line contains
Output Specification
If no such array exists, output -1
.
Otherwise, output the elements of the lexicographically least array on a single line.
Sample Input
5
0 0 2 2 1
1 0 2 1 0
0 1 0 1 2
2 1 0 0 0
Sample Output
2 1 4 3 2
Explanation for Sample
The array above satisfies all the requirements except for
Comments
I'm still here...
hi still here
wac7 when