Messy Kevin


Submit solution

Points: 1
Time limit: 1.5s
Memory limit: 256M

Author:
Problem type
Allowed languages
C++, Java, Python

Kevin from the IT team was tasked with syncing server logs from two machines. As usual, he messed it up. Instead of keeping the logs in one neat sequence, he dumped parts of the logs into two separate files. Now you've been called in to clean up the mess and merge the logs properly.

Each log file was already sorted before Kevin touched them, but we need them to be in a single file for our analysis. Your job is to merge the two log files into a single chronologic, neat, and tidy sequence.

Kevin's counting on you. (Mostly because he doesn't know how to fix it himself.)

Input

The first line contains two space-separated integers m\ n\ (1 \leq m,n \leq 10^4), representing the number of elements in files a and file b respectively.

The second line contains m space-separated integers a_i\ (-10^4 \leq a_i \leq 10^4), representing the ith element in file a.

The third line contains n space-separated integers b_i\ (-10^4 \leq b_i \leq 10^4), representing the ith element in file b.

Output

Print the merged file in non-decreasing order - a single line of space-separated integers of length m+n.

The time complexity of your solution must be linear in the input lengths - O(m+n) - or faster.

Example

Input 1
3 4
1 2 3
2 5 6 7
Output 1
1 2 2 3 5 6 7
Input 2
2 3
8 0
0 1 2
Output 2
0 0 1 2 8

Comments

There are no comments at the moment.