array = [int(input()) for i in range(5)]
for j in range(4):
if array[j] < array[j + 1]:
array[j] += 1
array[j + 1] += 1
for item in array:
print(item, end = " ")
array = [int(input()) for i in range(5)]
for j in range(4):
if array[j] < array[j + 1]:
array[j] += 1
array[j + 1] += 1
for item in array:
print(item, end = " ")