import sys


class ListNode:
    def __init__(self,value=0,next=None):
        self.value=value
        self.next=next


def parse_input(s):
    if not s:
        return None
    
    head=ListNode(s[0])
    cur=head
    for val in s[1:]:
        cur.next=ListNode(val)
        cur=cur.next
    
    return head

headA=parse_input(list(map(int,input().strip().split())))
headB=parse_input(list(map(int,input().strip().split())))

curA=headA
curB=headB
res=[]
while curA or curB:
    if curA and (not curB or curA.value<=curB.value):
        res.append(str(curA.value))
        curA=curA.next
    elif curB:
        res.append(str(curB.value))
        curB=curB.next

print(" ".join(res))






python