첫 번째 줄에 첫 번째 리스트의 크기 N(1<=N<=100)이 주어집니다.
두 번째 줄에 N개의 리스트 원소가 오름차순으로 주어집니다.
세 번째 줄에 두 번째 리스트의 크기 M(1<=M<=100)이 주어집니다.
네 번째 줄에 M개의 리스트 원소가 오름차순으로 주어집니다.
각 리스트의 원소는 int형 변수의 크기를 넘지 않습니다.
오름차순으로 정렬된 리스트를 출력합니다.
3
1 3 5
5
2 3 6 7 9
1 2 3 3 5 6 7 9
# 입력
n = int(input())
aList = list(map(int, input().split()))
m = int(input())
bList = list(map(int, input().split()))
# 두 리스트 합치기
cList = aList + bList
cList.sort()
# 출력
for i in cList:
print(i, end=' ')
# 입력
n = int(input())
aList = list(map(int, input().split()))
m = int(input())
bList = list(map(int, input().split()))
# 포인터
p1=p2=0
cList = list()
while p1<n and p2<m:
if aList[p1] <= bList[p2]:
cList.append(aList[p1])
p1 += 1
else:
cList.append(bList[p2])
p2 += 1
# 남은 리스트 값 합치기
if p1<n:
cList = cList+aList[p1:]
if p2<m:
cList = cList+bList[p2:]
# 출력
for i in cList:
print(i, end=' ')