import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public ArrayList<Integer> solution(int n, int m, int[] a, int[] b){
ArrayList<Integer> answer = new ArrayList<>();
int p1 = 0, p2 = 0; //포인터
while (p1 < n && p2 < m) { // 둘 중 배열이 끝나면 끝
if(a[p1] < b[p2]) answer.add(a[p1++]);
else answer.add(b[p2++]);
}
while (p1 < n) answer.add(a[p1++]); //나머지 넣기
while (p2 < m) answer.add(b[p2++]); //나머지 넣기
return answer;
}
public static void main(String[] args){
Main T = new Main();
Scanner kb =new Scanner(System.in);
int n = kb.nextInt();
int[] a = new int[n];
for(int i = 0; i < n; i++) {
a[i] = kb.nextInt();
}
int m = kb.nextInt();
int[] b = new int[m];
for(int i = 0; i < m; i++) {
b[i] = kb.nextInt();
}
for(int x : T.solution(n, m, a, b)) System.out.print(x + " ");
}
}