import sys class ListNode: def __init__(self, value=0, next=None): self.value = value self.next = next def parse_input(slist): if not slist: return None head = ListNode(slist[0]) curr = head for value in slist[1:]: curr.next = ListNode(value) curr = curr.next return head a = list(input().strip().split()) b = list(input().strip().split()) headA = parse_input(a) headB = parse_input(b) res = [] curA = headA curB = headB while curA or curB: if curA and (not curB or curA.value <= curB.value): res.append(curA.value) curA = curA.next elif curB: res.append(curB.value) curB = curB.next print(" ".join(map(str,res)))