number = str(input())
list_number = [n for n in number]
if len(number) == 5:
list_number[0], list_number[2] = list_number[2], list_number[0]
list_number[1], list_number[3] = list_number[3], list_number[1]
for i in list_number:
print(i, end = '')
number = str(input())
list_number = [n for n in number]
if len(number) == 5:
list_number[0], list_number[2] = list_number[2], list_number[0]
list_number[1], list_number[3] = list_number[3], list_number[1]
for i in list_number:
print(i, end = '')