Problem L. Limited permutation

Author:A. Baranov   Time limit:1 sec
Input file:Standard input   Memory limit:256 Mb
Output file:Standard output  

Statement

There are two integer arrays A and B, of length N each.

Your program must generate lexicographically minimal permutation of A, satisfying conditions:

Ai ≤ Bi, i = 1, 2, …, N

Input format

Input contains integer N, followed by 2⋅ N integers: array A, then array B.

Output format

Output must contain N integers — resulting permutation.

If the solution does not exist, output a single number  − 1.

Constraints

0 ≤ Ai, Bi ≤ 109, 1 ≤ N ≤ 2 ⋅ 105

Sample tests

No. Standard input Standard output
1
5
1 9 3 7 5
9 3 9 1 9
5 3 7 1 9
2
5
1 9 3 7 5
9 3 3 1 7
-1

0.090s 0.019s 13