cswork / OAOpen practice workspace

IBMOA #54

Merge 2 Arrays

Estimated EasyJudge-ready

Topics (AI-labelled)Two Pointers

Merge two non-decreasing arrays, each of length n, and output all 2n elements, keeping duplicates.

Input

The first line contains n, the second line contains array a, and the third line contains array b. Full original ranges: 2≤n≤100000, 0≤a[i],b[i]≤10^9, and both arrays are sorted.

Output

Output the 2n integers in non-decreasing order.

Example 1

Input:

3
1 2 3
2 5 5

Output:

1 2 2 3 5 5

Example 2

Input:

2
0 0
0 1

Output:

0 0 0 1

Example 3

Input:

2
9 10
1 2

Output:

1 2 9 10

Example notes

The examples give 1 2 2 3 5 5; 0 0 0 1; and 1 2 9 10 respectively.

Editorial

Loading solution…