try:
while True:
x=input()
number_string = input()
number_ary = list(map(int, number_string.split()))
print(" ".join(str(i) for i in number_ary))
for i in range(len(number_ary)-1):
number_ary.reverse()
number_ary.pop()
print(" ".join(str(i) for i in number_ary))
pass
except:
pass