yu=int(input())-1
li=list(map(int,input().split()))
li=li[::-1]
for i in range(yu):
     print(li[i],end="->")
print(li[yu])

c3bc6c0635d4189db0d93d9df32b22999c0bdfbe
<mask token>

<mask token>
for i in range(yu):
    print(li[i], end='->')
print(li[yu])

yu = int(input()) - 1
li = list(map(int, input().split()))
li = li[::-1]
for i in range(yu):
    print(li[i], end='->')
print(li[yu])

yu=int(input())-1
li=list(map(int,input().split()))
li=li[::-1]
for i in range(yu):
     print(li[i],end="->")
print(li[yu])
