Two sections of a class have their marks lists, each already sorted. The teacher wants one combined sorted list.
Merge the two sorted arrays into one sorted array without sorting from scratch.
Input Format
The first line has n and m.
The second line has n sorted integers.
The third line has m sorted integers.
Output Format
Print the merged sorted list, separated by single spaces.
Constraints
• 1 ≤ n, m ≤ 1000
• -10^4 ≤ value ≤ 10^4
Examples
Example 1
Input
3 4
1 4 9
2 3 10 12
Output
1 2 3 4 9 10 12
Explanation Pick the smaller front each time: 1, 2, 3, 4, 9, 10, 12.
Example 2
Input
2 2
5 5
5 5
Output
5 5 5 5
Explanation Equal values are all kept.
Example 3
Input
1 3
100
1 2 3
Output
1 2 3 100
Explanation The second list finishes first, then 100 is copied.
Acceptance
—
Accepted
0
Submissions
0