Merging Two Sorted Arrays

Merge two sorted arrays into one sorted sequence with a two-pointer walk.

Easy3Two pointersArrayInterviewNo attempts yetTime limit1.5sMemory limit256 MB

Problem

You are given two arrays AA and BB, each sorted in non-decreasing order. Write a program that combines all of their elements and prints them in non-decreasing order.

Input

The first line contains the size NN of array AA and the size MM of array BB, separated by a space. (1N,M1061 \le N, M \le 10^6)

The second line contains the NN elements of array AA, and the third line contains the MM elements of array BB, separated by spaces. Every element is an integer whose absolute value is at most 10910^9, and both arrays are already sorted in non-decreasing order.

Output

On the first line, print the combined elements of both arrays in non-decreasing order, separated by single spaces. If a value appears several times, print it as many times as it appears.