sample_list1 = [int(x) for x in input().split(',')]
sample_list2 = [int(x) for x in input().split(',')]
l = []
arr = sample_list1 + sample_list2  # The merged result is stored in arr

s = set(arr)  # The set function removes duplicates in arr
l = list(s)
l.sort()  # The sort method sorts the array in ascending order
print(l)

# OR

# After taking input and merging into arr, the following steps can be done.

d = {}  # Dictionary

for ele in arr:
    if ele in d:
        d[ele] += 1
    else:
        d[ele] = 1

# This part uses a dictionary to count the number of occurrences of each number.