11381138 SUSTech Online Judge
Problem 1138 --Merge Sort[Easy]

1138: Merge Sort[Easy]

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 1162  Solved: 264
[Submit][Status][Web Board]

Description

Merge sort is a widely known sorting algorithm. In each step of merge sort, it sorts two arrays and combines  them to one sorted array. Now, Joy has already implemented the algorithm successfully, but he does not know how to combine  two sorted arrays to ones. Can you help Joy?

Input

First line will be a positive integer T (T<=15), which is the number of test cases.

In each test case, the first line will be two integer n and m, which are the lengths of the two arrays. The second line will be the terms of the first array. The third line will be the terms of the second array.

(1 <= n, m <= 100000, the combat values will in the range of [0, 109])

Output

For each test case, print the combined array.

Sample Input

2
4 5
1 2 3 4
1 2 3 4 5
1 3
2
1 3 4

Sample Output

1 1 2 2 3 3 4 4 5
1 2 3 4

HINT

Source

 

[Submit][Status]