s = input()
sum = len(s)
r = ""
j = sum
for i in range(0,sum):
if s[sum - i - 1] == " ":
r = r + " " + s[sum - i: j]
j = sum - i - 1
r = r + " " + s[0:j]
print(r[1:len(r)])
s = input()
sum = len(s)
r = ""
j = sum
for i in range(0,sum):
if s[sum - i - 1] == " ":
r = r + " " + s[sum - i: j]
j = sum - i - 1
r = r + " " + s[0:j]
print(r[1:len(r)])