CodeEff/ECCO huggingface dataset:
# Original solution
def main():

    N = int(eval(input()))
    A = list(map(int, input().split()))
    even = [v for v in A if v % 2 == 0]
    if all((v % 3 == 0) or (v % 5 == 0) for v in even):
        return "APPROVED"
    return "DENIED"

if __name__ == '__main__':
    print((main()))


# Optimized solution
def main():

    N = int(eval(input()))
    A = list(map(int, input().split()))

    for i in range(N):
        if A[i] % 2 == 0 and (A[i] % 3 != 0 and A[i] % 5 != 0):
            return "DENIED"
    return "APPROVED"

if __name__ == '__main__':
    print((main()))
# Original solution
n = int(eval(input()))
L = list(map(int,input().split()))
L = [x for x in L if x%2 ==0]

if all((L[i]%3 == 0 or L[i]%5 == 0 for i in range(len(L)))):

    print("APPROVED")
else:
    print("DENIED")

# Optimized solution
n = int(eval(input()))
L = list(map(int,input().split()))

for i in range(n):
    if L[i]%2 == 0:
        if L[i]%3 == 0 or L[i]%5== 0:
            continue
        else:
            print("DENIED")
            exit()

print("APPROVED")
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))

B = list([x for x in A if x % 2 == 0])
C = list([(x % 5 == 0)or(x % 3 == 0) for x in B])

print((["APPROVED","DENIED"][False in C]))

# Optimized solution
eval(input())
print((["APPROVED","DENIED"]["1"in [format(0x28828228,'b')[int(x)%30-2] for x in input().split()]]))
# Original solution
n = int(eval(input()))
x = sum([1 for e in [int(a) for a in input().split(" ")] if not(e % 2 == 0 and e % 3 != 0 and e % 5 != 0)])
print(("APPROVED" if n == x else "DENIED"))

# Optimized solution
print(("APPROVED" if int(eval(input())) == sum([1 for e in [int(a) for a in input().split(" ")] if not(e % 2 == 0 and e % 3 != 0 and e % 5 != 0)]) else "DENIED"))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
 
ans = 'APPROVED'
for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0 and A[i] % 5 != 0:
      ans = 'DENIED'
      break
      
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

ans = 'APPROVED'
for i in range(N):
  if A[i] % 2 == 0 and A[i] % 3 != 0 and A[i] % 5 != 0:
    ans = 'DENIED'
    break
      
print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
count = 0

x = [i for i in a if i % 2 == 0]
for i in x:
    if i % 3 == 0 or i % 10 == 0:
        count += 1

if len(x) == count:
    print("APPROVED")
else:
    print("DENIED")


# Optimized solution
n = int(eval(input()))
a = [i for i in list(map(int, input().split())) if i % 2 == 0]
b = [i for i in a if i % 3 == 0 or i % 5 == 0]
if len(a) == len(b):
    print("APPROVED")
else:
    print("DENIED")
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
even_num = []
for i in A:
    if i % 2 == 0:
        even_num.append(i)
for j in range(len(even_num)):
    if even_num[j] % 3 != 0 and even_num[j] % 5 != 0:
        print('DENIED')
        exit()
print('APPROVED')

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split(' ')))
flag = True
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            pass
        else:
            flag = False

if flag:
    print("APPROVED")
else:
    print("DENIED")
# Original solution
def ng(n):
    return n%2==0 and n%3!=0 and n%5!=0
n = eval(input())
print(('DENIED' if any(ng(int(i)) for i in input().split()) else 'APPROVED'))

# Optimized solution
def ng(n):
    return not n%2 and n%3 and n%5
n = eval(input())
print(('DENIED' if any(ng(int(i)) for i in input().split()) else 'APPROVED'))
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
for i in A:
  if i%2==0:
    if i%3!=0 and i%5!=0:
      print("DENIED")
      break
else:
  print("APPROVED")

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))
print(("APPROVED" if all([i%2!=0 or i%3==0 or i%5==0 for i in A]) else "DENIED"))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))


i = 0

for i in range(len(A)):
    if (A[i] % 2 == 0):
        if A[i] % 3 != 0 and A[i] % 5 != 0:
            print('DENIED')
            exit()
        else:
            continue
    else:
        continue

print('APPROVED')

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))


i = 0

for i in range(len(A)):
    if (A[i] % 2 != 0 or (A[i] % 3 == 0 or A[i] % 5 == 0)):
        continue
    else:
        print('DENIED')
        exit()


print('APPROVED')
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = "APPROVED"
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            ans = "DENIED"
print(ans)

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
ans = "APPROVED"
for i in range(n):
    if a[i] % 2 == 0 and a[i] % 3 != 0 and a[i] % 5 != 0:
        ans = "DENIED"
print(ans)
# Original solution
from sys import exit

N = int(eval(input()))
A = tuple(map(int, input().split()))
for a in A:
    if a % 2 == 0:
        if not(a % 3 == 0 or a % 5 == 0):
            print('DENIED')
            exit()
print('APPROVED')


# Optimized solution
from sys import exit

N = int(eval(input()))
A = tuple(map(int, input().split()))
for a in A:
    if not a % 2 and a % 3 and a % 5:
        print('DENIED')
        exit()
print('APPROVED')
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
ans=True
for i in a:
    if not i%2 and i%3 and i%5:
        ans=False
        break
print(('APPROVED' if ans else 'DENIED'))

# Optimized solution
n,*a=list(map(int,open(0).read().split()))
print(("DENIED" if sum((i%3)*(i%5) for i in a if i%2==0) else "APPROVED"))
# Original solution
def main():
    _ = int(eval(input()))
    a = list(map(int, input().split()))
    odds = []
    for i in a:
        if i % 2 == 0:
            odds.append(i)

    for i in odds:
        if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            return

    print("APPROVED")


if __name__ == "__main__":
    main()


# Optimized solution
def main():
    _ = int(eval(input()))
    a = list(map(int, input().split()))
    odds = []
    for i in a:
        if i % 2 == 0:
            odds.append(i)

    for i in odds:
        if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            return

    print("APPROVED")


def main1():
    _ = int(eval(input()))
    a = list(map(int, input().split()))
    odds = list([x for x in a if x % 2 == 0])
    denied = list([x for x in odds if x % 3 != 0 and x % 5 != 0])
    if denied:
        print("DENIED")
    else:
        print("APPROVED")


if __name__ == "__main__":
    main1()
# Original solution
N=eval(input())
A=list(map(int,input().split()))
print(("APPROVED" if all([a%2!=0 or a%3==0 or a%5==0 for a in A]) else "DENIED"))

# Optimized solution
N=eval(input())
A=list(map(int,input().split()))
print(("APPROVED" if all(a%2!=0 or a%3==0 or a%5==0 for a in A) else "DENIED"))
# Original solution
n=int(eval(input()))
a=list(map(int,input().split()))
for i in range(n):
    if a[i]%2==0:
        if a[i]%3==0 or a[i]%5==0:
            pass
        else:
            print("DENIED")
            break
else:
    print("APPROVED")

# Optimized solution
n=int(eval(input()))
a=list(map(int,input().split()))

p=[]
for i in range(n):
    p.append(1)

z=0
for i in range(n):
    if a[i]%2==1:
        p[i]=0
    else:
        if a[i]%6==0:
            p[i]=0
        elif a[i]%10==0:
            p[i]=0
    z=z+p[i]

if z==0:
    print("APPROVED")
else:
    print("DENIED")
# Original solution
N = int(eval(input()))
li = list(map(int,input().split()))
even_li = [x for x in li if x%2 == 0]
ap = 0
for i in even_li:
    if i % 3 == 0 or i % 5 == 0:
        ap += 1
if even_li == []:
    print("APPROVED")
elif ap == len(even_li):
    print("APPROVED")
else:
    print("DENIED")

# Optimized solution
N = int(eval(input()))
li = list(map(int,input().split()))
app = 0
for i in li:
    if i % 2 == 0 and (i % 6 == 0 or i % 10 == 0):
        pass
    elif i % 2 == 0:
        app += 1
        break
if app == 0:
    print("APPROVED")
else:
    print("DENIED")
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            print('DENIED')
            exit()
print('APPROVED')


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            continue
        else:
            print('DENIED')
            exit(0)
print('APPROVED')
# Original solution
N = int(eval(input()))
a = list(map(int, input().split()))
el = []
for i in a:
    if i % 2 == 0:
        el.append(i)

for i in range(len(el)):
    if el[i] % 3 == 0 or el[i] % 5 == 0:
        el[i] = True
    else:
        el[i] = False

if el.count(False):
    print("DENIED") 
else:
    print("APPROVED")


# Optimized solution
N = int(input())
a = list(map(int, input().split()))
aeve = map(lambda x: x if x % 2 == 0 else 0, a)
ad35 = map(lambda x: True if x % 3 == 0 or x % 5 == 0 else False, aeve)
print("APPROVED") if all(ad35) else print("DENIED")
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
for a in A:
  if a % 2 == 1:
    continue
  if a % 3 == 0 or a % 5 == 0:
    continue
  print("DENIED")
  exit()
print("APPROVED")


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
         
for a in A:
      if a % 2 == 1:
         continue
      if a % 3 == 0:
         continue
      if a % 5 == 0:
         continue
      print("DENIED")
      exit()

print("APPROVED")
# Original solution
N = int(eval(input()))#.split()
A = input().split()
den = False
for i in range(N):
    if int(A[i]) % 2 == 0:
        if int(A[i]) % 3 != 0 and int(A[i]) % 5 != 0:
            print("DENIED")
            exit(0)
            den = True
if not den:
    print("APPROVED")


# Optimized solution
N = int(eval(input()))
A = input().split()
for i in range(N):
    if int(A[i])%2==0:
        if int(A[i])%3!=0 and int(A[i])%5!=0:
            print("DENIED")
            exit(0)
print("APPROVED")
# Original solution
def main():
    N = int(eval(input()))
    A = list(map(int,input().split()))
    answer = "APPROVED"
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                answer = "DENIED"
        else:
            pass
    print(answer)

if __name__ == "__main__":
    main()

# Optimized solution
def main():
    N = int(eval(input()))
    A = list(map(int,input().split()))
    answer = "APPROVED"
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                continue
            else:
                answer = "DENIED"
    print(answer)

if __name__ == "__main__":
    main()
# Original solution
stdin = open(0).read().split('\n')
N=int(stdin[0])
A=list(map(int,stdin[1].split()))
flag=True
for a in A:
    if a%2==0 and a%3!=0 and a%5!=0:flag=False
print(('APPROVED' if flag else 'DENIED'))

# Optimized solution
stdin = open(0).read().split('\n')
N=int(stdin[0])
A=list(map(int,stdin[1].split()))
flag=True
for a in A:
    if a%2==0 and a%3!=0 and a%5!=0:
        flag=False
        break
print(('APPROVED' if flag else 'DENIED'))
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
X = 0
Y = 0
for i in range(0,N):
  if A[i] % 2 == 0:
    X += 1
    if ((A[i] / 2) % 3 == 0) or ((A[i] / 2) % 5 == 0):
      Y += 1
if X == Y:
  print('APPROVED')
else:
  print('DENIED')

# Optimized solution
B = int(eval(input()))
N = list(map(int,input().split()))
A = 'APPROVED'
for i in range(len(N)):
  if  N[i] %2 ==0 :
    if N[i] % 3 != 0 and N[i] % 5 != 0:
      A = 'DENIED'
      break
    else:
      continue
print(A)
# Original solution
def main():
    X = int(eval(input()))
    # A = list(map(int, input().split()))
    A = input().split()

    b = []
    for ai in A:
        b.append(ai)
        b = b[::-1]
        # print(b)

    print((" ".join(b)))

if __name__ == "__main__":
    main()

# Optimized solution
def main():
    N = int(eval(input()))
    # A = list(map(int, input().split()))
    A = input().split()

    # b = []
    # for ai in A:
    #     b.append(ai)
    #     b = b[::-1]
    #     # print(b)
    # print(" ".join(b))

    b = []
    for i in range(N - 1, -1, -2):
        b.append(A[i])
    
    if N % 2 == 0:
        for i in range(0, N, 2):
            b.append(A[i])

    else:
        for i in range(1, N, 2):
            b.append(A[i])

    print((" ".join(b)))


if __name__ == "__main__":
    main()
# Original solution
from collections import deque
n,a,b=int(input()),deque(map(int,input().split())),deque()
for i in range(n):
  if n%2==0:
    if i%2==0:
      b.append(a[i])
    else:
      b.appendleft(a[i])
  else:
    if i%2==0:
      b.appendleft(a[i])
    else:
      b.append(a[i])
print(*b,sep=' ')


# Optimized solution
n,a=int(input()),list(map(int,input().split()))
b=[a[1::2][::-1]+a[::2],a[0::2][::-1]+a[1::2]][n%2]
print(*b,sep=' ')
# Original solution
n,a=int(input()),list(map(int,input().split()))
b=[a[1::2][::-1]+a[::2],a[0::2][::-1]+a[1::2]][n%2]
print(*b,sep=' ')


# Optimized solution
n,a=int(input()),list(map(int,input().split()))
print(*[a[1::2][::-1]+a[::2],a[0::2][::-1]+a[1::2]][n%2],sep=' ')
# Original solution
n = int(eval(input()))
a = list(map(int,input().rstrip().split(" ")))
b1 = []
b2 = []
ans = []
if n % 2 == 0:
    for i in range(n):
        if n % 2 == 0:
            b1.append(a[i])
        else:
            b2.append(a[i])
        b1.reverse()
        ans = b1 + b2
    print((" ".join(str(i) for i in ans)))
else:
    for i in range(n):
        if n % 2 == 0:
            b1.append(a[i])
        else:
            b2.append(a[i])
        b2.reverse()
        ans = b2 + b1
    print((" ".join(str(i) for i in ans)))

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().rstrip().split(" ")))
b1 = []
b2 = []
ans = []
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            b1.append(a[i])
        else:
            b2.append(a[i])
    b2.reverse()
    ans = b2 + b1
    print((" ".join(str(i) for i in ans)))
else:
    for i in range(n):
        if i % 2 == 0:
            b1.append(a[i])
        else:
            b2.append(a[i])
    b1.reverse()
    ans = b1 + b2
    print((" ".join(str(i) for i in ans)))
# Original solution
n = int(input())
L = [None]+list(input().split())
even = []
odd = []
if n % 2 == 0:
    for i in range(1,1+n):
        if i % 2 == 0:
            even.append(L[i])
        else:
            odd.append(L[i])
    for j in range(len(even[::-1])):
        if j == len(even) - 1:
            print(even[::-1][j],end=' ')
        else:
            print(even[::-1][j],end=' ')
    for y in range(len(odd)):
        if y == len(odd) - 1:
            print(odd[y],end='')
        else:
            print(odd[y],end=' ')
    print()
else:
    for i in range(1,1+n):
        if i % 2 == 0:
            even.append(L[i])
        else:
            odd.append(L[i])
    for y in range(len(odd[::-1])):
        if y == len(odd) - 1:
            print(odd[::-1][y],end=' ')
        else:
            print(odd[::-1][y],end=' ')
    for x in range(len(even)):
        if x == len(even) -1:
            print(even[x],end='')
        else:
            print(even[x],end=' ')
    print()


# Optimized solution
n = int(input())
L = [None]+list(input().split())
even = []
odd = []
if n % 2 == 0:
    for i in range(1,1+n):
        if i % 2 == 0:
            even.append(L[i])
        else:
            odd.append(L[i])
    ans = even[::-1] + odd
else:
    for i in range(1,1+n):
        if i % 2 == 0:
            even.append(L[i])
        else:
            odd.append(L[i])
    ans = odd[::-1] + even
for i in range(n):
    if i == n - 1:
        print(ans[i])
    else:
        print(ans[i],end=' ')
# Original solution
def main():
    length = int(eval(input()))
    numbers = list(map(int, input().split()))
    answer = []
    for num in numbers:
        answer.append(num)
        answer = list(reversed(answer))
    print((" ".join(map(str, answer))))


if __name__ == '__main__':
    main()



# Optimized solution
def main():
    length = int(eval(input()))
    numbers = list(map(int, input().split()))
    answer = [0] * length
    if length % 2:
        answer[:length // 2 + 1] = numbers[::-2]
        answer[length // 2 + 1:] = numbers[1::2]
    else:
        answer[:length // 2] = numbers[::-2]
        answer[length // 2:] = numbers[::2]
    print((" ".join(list(map(str, answer)))))


if __name__ == '__main__':
    main()
# Original solution
N=int(input())
A=list(map(int,input().split()))
ans=[]
for i in range(N):
        if N%2==0:
                if i%2==0:
                        ans.append(A[i])
                else:
                        ans.insert(0,A[i])
        else:
                if i%2==0:
                        ans.insert(0,A[i])
                else:
                        ans.append(A[i])             
print(*ans,sep=" ")


# Optimized solution
N=int(input())
A=list(map(int,input().split()))
ans=[0 for i in range(N)]
c=0
d=0
for i in range(N):
        if N%2==0:
                if i%2==0:
                        ans[N//2+c]=A[i]
                        c+=1
                else:
                        ans[N//2-1-d]=A[i]
                        d+=1
        else:
                if i%2==0:
                        ans[N//2-d]=A[i]
                        d+=1
                else:
                        ans[N//2+1+c]=A[i]
                        c+=1 
print(*ans,sep=" ")
# Original solution
n=int(eval(input()))
a=list(map(str,input().split()))
b=[]
for i in range(n):
    b.append(a[i])
    b.reverse()
print((" ".join(b)))


# Optimized solution
n=int(eval(input()))
a=list(map(str,input().split()))
b,c=[],[]
if n%2==0:
    for i in range(n):
        if i%2==0:
            b.append(a[i])
        else:
            c.append(a[i])
    c.reverse()
else:
    for i in range(n):
        if i%2==1:
            b.append(a[i])
        else:
            c.append(a[i])
    c.reverse()
print((" ".join(c+b)))
# Original solution
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in a:
    ans = ans + [i]
    ans = ans[::-1]
print(*ans,sep=" ")


# Optimized solution
n = int(input())
a = list(map(int,input().split()))
if n % 2 == 0:
    a = a[::-2]+a[0::2]
else: a = a[::-2] +a[1::2]
print(*a,sep=" ")
# Original solution
n = int(input())
num_list = list(map(int, input().split()))
b = []
for a in num_list:
    b.append(a)
    b = [i for i in (reversed(b))]
for i in range(len(b)):
    if i != len(b)-1:
        print(b[i],end="")
        print(" ", end="")
    else:
        print(b[i])
    


# Optimized solution
n = int(input())
a_list = list(map(int, input().split()))
a1_list = []
a2_list = []
n_list = [0]*n
if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            a1_list.append(a_list[i])
        else:
            a2_list.append(a_list[i])
    for i in reversed(a2_list):
        print(i, end="")
        print(" ", end="")
    for i in a1_list:
        if i != a1_list[int((n-2)/2)]:
            print(i, end="")
            print(" ", end="")
        else:
            print(i)
else:
    for i in range(1,n):
        if i % 2 == 0:
            a1_list.append(a_list[i])
        else:
            a2_list.append(a_list[i])
    for i in reversed(a1_list):
        print(i, end="")
        print(" ", end="")
    print(a_list[0], end="")
    print(" ", end="")
    for i in a2_list:
        if i != a2_list[int((n-2)/2)]:
            print(i, end="")
            print(" ", end="")
        else:
            print(i)
# Original solution
n = int(eval(input()))
a = list(map(int ,input().split()))
b = []
for i in range(n):
    b.append(a[i])
    b = b[::-1]
print((" ".join(map(str,b))))

# Optimized solution
n = int(eval(input()))
a = list(map(str,input().split()))
b = []

for i in range(n-1-(1-(n-1)%2),0,-2):
    b.append(a[i])
for i in range(0,n-1-(n-1)%2+1,2):
    b.append(a[i])

if n%2 == 1:
    b = b[::-1]
print((" ".join(b)))
# Original solution
#ABC066C
n=int(eval(input()))
a=list(map(int, input().split()))
front=[]
back=[]
flg=n%2
for i in range(n//2):
    front.insert(0, a[2*i-flg+1])
    #back.append(a[2*i+flg])
back=[a[2*i+flg] for i in range(n//2)]
if flg==1:
    front.insert(0, a[n-1])
print((' '.join(map(str, front+back))))


# Optimized solution
#ABC066C
n=int(eval(input()))
a=list(map(int, input().split()))
flg=n%2
half=n//2
front=[0]*(half+flg)
back=[0]*(half)
for i in range(half):
    front[half+flg-1-i]=a[2*i-flg+1]
    back[i]=a[2*i+flg]
if flg==1:
    front[0]=a[n-1]
print((' '.join(map(str, front+back))))
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))
b = []
for ai in a:
  b.append(str(ai))
  b = list(reversed(b))
print((' '.join(b)))

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
#b = []
#for ai in a:
#  b.append(str(ai))
#  b = list(reversed(b))
#print(' '.join(b))
if len(a) % 2 == 0:
  even = []
  odd = []
  for i, ai in enumerate(a):
    if (i + 1) % 2 == 0:
      even.append(str(ai))
    else:
      odd.append(str(ai))

  r = list(reversed(even))
  answer = r + odd
  print((' '.join(answer)))
else:
  even = []
  odd = []
  for i, ai in enumerate(a):
    if (i + 1) % 2 == 0:
      even.append(str(ai))
    else:
      odd.append(str(ai))
  r = list(reversed(odd))
  answer = r + even
  print((' '.join(answer)))
# Original solution
n = int(eval(input()))
a = [int(i) for i in input().split()]
b = []
for i in a:
    b.append(i)
    b = list(reversed(b))
b = [str(b_) for b_ in b]
ans = " ".join(b)
print(ans)

# Optimized solution
n = int(eval(input()))
a = [int(i) for i in input().split()]
e = [a[i] for i in range(n) if i % 2 == 1]
o = [a[i] for i in range(n) if i % 2 == 0]
if (n % 2 == 1):
    ans = o[::-1] + e
else:
    ans = e[::-1] + o
ans = [str(i) for i in ans]
ans = " ".join(ans)
print(ans)
# Original solution
# coding: utf-8
n=int(eval(input()))
A=list(map(int,input().split()))
b=[]
for i in range(n):
    if i%2==0:
        b.append("{}".format(A[i]))
    else:
        b.insert(0,"{}".format(A[i]))

if n%2==1:
    b.reverse()
    print((" ".join(b)))
else:
    print((" ".join(b)))



# Optimized solution
# coding: utf-8
n=int(eval(input()))
A=list(map(int,input().split()))
l=[]
r=[]
k=1
for i in range(n):
    if i%2==0:
        r.append("{}".format(A[i]))
    else:
        l.append("{}".format(A[i]))
l.reverse()

b=l+r

if n%2==1:
    b.reverse()

print((" ".join(b)))
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(str(a[i]))
  b.reverse()
print((" ".join(b)))

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
left = []
right = []
for i in range(n):
  right.append(str(a[i]))
  left,right = right,left
left.reverse()
print((" ".join(left+right)))
# Original solution
N = int(eval(input()))
l = list(map(int, input().split()))
ans = []

if N % 2 == 0:
    flag = 0
else:
    flag = 1

for ix,i in enumerate(l):
    if ix % 2 == flag:
        ans.append(i)
    else:
        ans.insert(0, i)
    
print((" ".join(map(str, ans))))

# Optimized solution
n = int(eval(input()))
a = list(map(str,input().split()))
b = a[::-1]
b = b[::2]

if n%2 == 0:
  c = a[::2]
else:
  c = a[1::2]
d = b+c

if n >= 2:
  print((' '.join(d)))
else:
  print((a[0]))
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
b = []
for i in range(n):
  b.append(a[i])
  b.reverse()
print((' '.join(map(str,b))))

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
b = []
for i in range((n+1)//2):
  here = n-1-2*i
  b.append(str(a[here]))
for i in range(n//2):
  here = 2*i+(n%2)
  b.append(str(a[here]))
print((' '.join(b)))
# Original solution
n = int(eval(input()))
a = input().split()

b = []
if n % 2:
    flg = False
else:
    flg = True
for v in a:
    if flg:
        b.append(v)
        flg = False
    else:
        b.insert(0,v)
        flg = True

print((' '.join(b)))

# Optimized solution
n = int(eval(input()))
a = input().split()
reb_a = a[::-1]
if n % 2 == 0:
    res = reb_a[::2]+a[::2]
else:
    res = reb_a[::2]+a[1::2]

print((' '.join(res)))