one = tuple(map(str,input().split())) two = tuple(map(str,input().split())) print(one) print(two) three = [] three.extend(list(one[:3])) three.extend((list(two[-3:]))) print(tuple(three))