#abc294c. [abc294_c]Merge Sequences
[abc294_c]Merge Sequences
Problem Statement
You are given strictly increasing sequences of length and : and . Here, for every and .
Let be a strictly increasing sequence of length that results from the following procedure.
- Let be the concatenation of and . Formally, let for , and for .
- Sort in ascending order.
For each of $A _ 1,A _ 2,\\ldots,A _ N, B _ 1,B _ 2,\\ldots,B _ M$, find its position in . More formally, for each , find such that , and for each , find such that .
Constraints
- $1\\leq A _ 1\\lt A _ 2\\lt\\cdots\\lt A _ N\\leq 10^9$
- $1\\leq B _ 1\\lt B _ 2\\lt\\cdots\\lt B _ M\\leq 10^9$
- for every and .
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer in two lines.
The first line should contain the positions of in , with spaces in between.
The second line should contain the positions of in , with spaces in between.
Sample Input 1
4 3
3 14 15 92
6 53 58
Sample Output 1
1 3 4 7
2 5 6
will be . Here, the -st, -rd, -th, -th elements are from , and the -nd, -th, -th elements are from .
Sample Input 2
4 4
1 2 3 4
100 200 300 400
Sample Output 2
1 2 3 4
5 6 7 8
Sample Input 3
8 12
3 4 10 15 17 18 22 30
5 7 11 13 14 16 19 21 23 24 27 28
Sample Output 3
1 2 5 9 11 12 15 20
3 4 6 7 8 10 13 14 16 17 18 19