lst = [int(input()) for _ in range(int(input('n = ')))]
print(*reversed([i for i in lst[:len(lst) // 2]]), *[j for j in lst[len(lst) // 2:]])
lst = [int(input()) for _ in range(int(input('n = ')))]
print(*reversed([i for i in lst[:len(lst) // 2]]), *[j for j in lst[len(lst) // 2:]])