~/algor $ cat problems/massiv-saralanganlarni-birlashtirish
Merging sorted arrays
Medium
1000 ms
64 MB
66%
Two arrays sorted in increasing order are given: of $n$ and of $m$ elements. Merge them into one array in increasing order and print it.
Input
The first line contains a positive integer $n$, the second — $n$ integers.
The third line contains a positive integer $m$, the fourth — $m$ integers. Both arrays are in increasing order (equal adjacent elements are possible).
Output
$n + m$ integers separated by spaces.
Note
$1 \le n, m \le 1000$
the elements are from $-10^{6}$ to $10^{6}$
Examples
Input #1
4 1 4 6 9 3 2 4 10
Output #1
1 2 4 4 6 9 10
Input #2
1 5 2 -3 -1
Output #2
-3 -1 5