Problem:
 Score : 300 points    Problem Statement You are given an integer sequence of length n , a_1, ..., a_n .
Let us consider performing the following n operations on an empty sequence b .  The i -th operation is as follows:   Append a_i to the end of b .  Reverse the order of the elements in b .   Find the sequence b obtained after these n operations.      Constraints  1 \leq n \leq 2\times 10^5  0 \leq a_i \leq 10^9  n and a_i are integers.         Input Input is given from Standard Input in the following format:  n  a_1  a_2  ...  a_n       Output Print n integers in a line with spaces in between.
The i -th integer should be b_i .        Sample Input 1 4
1 2 3 4      Sample Output 1 4 2 1 3   After step 1 of the first operation, b becomes: 1 .  After step 2 of the first operation, b becomes: 1 .  After step 1 of the second operation, b becomes: 1, 2 .  After step 2 of the second operation, b becomes: 2, 1 .  After step 1 of the third operation, b becomes: 2, 1, 3 .  After step 2 of the third operation, b becomes: 3, 1, 2 .  After step 1 of the fourth operation, b becomes: 3, 1, 2, 4 .  After step 2 of the fourth operation, b becomes: 4, 2, 1, 3 .   Thus, the answer is 4 2 1 3 .       Sample Input 2 3
1 2 3      Sample Output 2 3 1 2  As shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2 .       Sample Input 3 1
1000000000      Sample Output 3 1000000000       Sample Input 4 6
0 6 7 6 7 0      Sample Output 4 0 6 6 0 7 7

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a_even = a[0::2]
a_odd  = a[1::2] 


if (n - 1) % 2 == 0: 
    b = a_even.copy()
    b.reverse()
    b = b + a_odd

else:
    b = a_odd.copy()
    b.reverse()
    b = b + a_even

b = list(map(str, b))
print(' '.join(b))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))

if n % 2 == 0:
    x = n//2
    for i in range(x):print(a[(n-1)-(2*i)])
    for i in range(x):print(a[2*i])
else:
    x = n//2 + 1
    for i in range(x):print(a[(n-1)-(2*i)])
    for i in range(x-1):print(a[(2*i)+1])

Solution (Python):
import collections

def f(myList):
    ans = ''
    if len(myList)%2==0:
        for i in range(len(myList)):
            ans += str(myList[i]) + ' '
    else:
        for i in range(len(myList)):
            ans += str(myList[-(i+1)]) + ' '
    return ans[:-1]

n = int(input())
a = list(map(int,input().split()))
b = collections.deque()
for i in range(n):
    if i%2==0:
        b.append(a[i])
    else:
        b.appendleft(a[i])
print(f(b))

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
d=[]
s=[]
for i in range(n):
    if(i%2==0):
        d.append(l[i])
    else:
        s.append(l[i])
if(n%2==0):
    s.reverse()
    print(*(s+d))
else:
    d.reverse()
    print(*(d+s))

Solution (Python):
def main():
    n = int(input())
    A = input().split()
    evens = []
    odds = []
    for idx, a in enumerate(A, start=1):
        if idx % 2 == 0:
            evens.append(a)
        else:
            odds.append(a)

    if n % 2 == 0:
        evens.reverse()
        print((' ').join(evens + odds))
    else:
        odds.reverse()
        print((' ').join(odds + evens))


if __name__ == '__main__':
    main()

Solution (Python):
n,a=int(input()),list(map(int,input().split()))
print(*[a[1::2][::-1]+a[::2],a[::2][::-1]+a[1::2]][n%2],sep=' ')

Solution (Python):
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=' ')

Solution (Python):
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=' ')

Solution (Python):
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=' ')

Solution (Python):

 

 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy


 











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

B=[0]*N

for i in range(N):
  if i<(N+1)//2:
    B[i]=A[N-1-2*i]
  else:
    B[i]=A[N-2*(N-i)]

print(*B)

Solution (Python):
n = int(input())
a = list(map(str, input().split()))
b = []
'''
b = [str(a[0])]
if (n == 1):
    print(a[0])
    exit()

a = a[1:]

for i in a:
    b.append(str(i))
    b.reverse()
'''
'''
loop = int(n / 2)
loop_rest = n - loop

for i in range(loop):
    tar_index = (n - 1) - 2 * i
    tar = a[tar_index]

    b.append(str(tar))


if (n % 2 == 0):
    tar_index = 0
else:
    tar_index = 1

for i in range(loop_rest):
    b.append(str(a[tar_index]))
    tar_index += 2
'''









if n % 2 == 1:
    print(" ".join((a[0::2][::-1] + a[1::2])))
else:
    print(" ".join((a[1::2][::-1] + a[0::2])))

Solution (Python):
from collections import deque
n = int(input())
a = list(map(int,input().split()))
b_1 = deque()
b_2 = deque()
switch = 0
for i in a:
    if switch == 0:
        b_1.append(i)
        b_2.appendleft(i)
        switch = 1
    else:
        b_2.append(i)
        b_1.appendleft(i)
        switch = 0
b_1 = list(b_1)
b_2 = list(b_2)
if switch == 0:
    print(' '.join(list(map(str,b_1))))
else:
    print(' '.join(list(map(str,b_2))))

Solution (Python):
import math
from collections import defaultdict,deque
from itertools import permutations
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:list(input())
ips=lambda:input().split()

"""========main code==============="""
t=1

for _ in range(t):
    n=ii()
    a=ll()
    i=n-1;
    while(i>-1):
        print(a[i],end=" ")
        i-=2
    for i in range(n%2,n,2):
        print(a[i],end=" ")

Solution (Python):
n = int(input())
a = reversed(list(map(int, input().split())))
ans = [-1] * n
i = 0
for _a in a:
    if i % 2 == 0:
        ans[i // 2] = _a
    else:
        ans[-((i // 2) + 1)] = _a
    i += 1
for _ans in ans:
    print(_ans, end=" ")

Solution (Python):
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    n = I()
    a = LI()
    if n % 2 == 0:
        print(*a[::-2],*a[::2])
    else:
        print(*a[::-2],*a[1::2])
main()

Solution (Python):
N = int(input())
a = list(map(int,input().split()))

b = [0]*N 

if N % 2 == 0:
    even = N//2
    odd = even - 1
    for i in range(N):
        if i % 2 == 0:
            b[even] = str(a[i])
            even += 1
        else:
            b[odd] = str(a[i])
            odd -= 1
else:
    even = N//2
    odd = even + 1
    for i in range(N):
        if i % 2 == 0:
            b[even] = str(a[i])
            even -= 1
        else:
            b[odd] = str(a[i])
            odd += 1

print(' '.join(b))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = [0]*(n)

ans[n//2]=a[0]


for i in range(0,n//2,1):
    ans[i]=a[n-1-2*i]
    ans[n-1-i]=a[n-2-2*i]

print(" ".join(map(str,ans)))

Solution (Python):
n = int(input())
a_list = [int(x) for x in input().split()]
b = []
c = []
for i, a in enumerate(a_list):
    if i % 2 == 0:
        b.append(a)
    else:
        c.append(a)
if n % 2 == 0:
    d = list(reversed(c)) + b
else:
    d = list(reversed(b)) + c
print(*d)

Solution (Python):
n = int(input())
a = input().split()
b = [0] * n
for i in range(n):
    if i % 2 == 0:
        b[i//2] = a[n-1-i]
    else:
        b[n-(i+1)//2] = a[n-1-i]
print(' '.join(b))

Solution (Python):
n = int(input())
a = input().split()
 
if n % 2 == 1:
    print(" ".join((a[0::2][::-1] + a[1::2])))
else:
    print(" ".join((a[1::2][::-1] + a[0::2])))

Solution (Python):
n = int(input())
A = [a for a in input().split(" ")]

if n == 1:
  print(A[0])
else:
  odd = A[::2]
  even = A[1::2]
  if n % 2 == 0:
    even.reverse()
    print(" ".join(even + odd))
  else:
    odd.reverse()
    print(" ".join(odd + even))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

cnt = 0
b = []
c = []
for i in range(n):
  if i == 0:
    b.append(a[i])
  elif i % 2 == 0:
    b.append(a[i])
  elif i % 2 == 1:
    c.append(a[i])

if n % 2:
  ans = b[::-1] + c
else:
  ans = c[::-1] + b
print(*ans)

Solution (Python):
def main():
    n = int(input())
    inlis = list(map(int, input().split()))

    anslis = []
    for _ in range(n):
        anslis.append("")

    if n % 2 == 0:
        for i in range(n):
            if i < n // 2:
                a = -2 * i + n 
            else:
                a = (i - n //2) * 2 + 1
            anslis[i] = inlis[a-1]
    else:
        for i in range(n):
            if i < n // 2:
                a = -2 * i + n
            elif i == n // 2:
                a = 1
            else:
                a = (i - n//2) * 2
            anslis[i] = inlis[a-1]
    print(*anslis)






if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
*A,=map(int,input().split())

if N%2==0:
    print(' '.join(map(str,A[1::2][::-1]+A[::2])))
else:
    print(' '.join(map(str,A[::2][::-1]+A[1::2])))

Solution (Python):
import sys 
from collections import deque
N = int(input())
A = list(map(int, input().split()))


if N == 1:
    print(A[0])
    sys.exit()

mae = deque()
usiro = deque()


Flag = 0

for i in reversed(range(0,N,1)):
    
    if Flag == 0: 
        mae.append(str(A[i]))
        mae.append(" ")
        Flag = 1
    else:
        usiro.insert(0,str(A[i]))
        usiro.appendleft(" ")
        Flag = 0

moziretu = (mae + usiro)
del moziretu[((len(moziretu))//2)]
moziretu = ''.join(moziretu)
print(moziretu)

Solution (Python):
N=int(input())
l=list(map(int,input().split()))
p=[0]*N
for i in range(N):
  if i<(N+1)//2:
    p[i]=l[N-1-2*i]
  else:
    p[i]=l[N-2*(N-i)]
print(*p)

Solution (Python):
n = int(input())
a = [ int(x) for x in input().split() ]

l = []
if n % 2 == 1:
    i = n-1
    while i >= 0:
        l.append(a[i])
        i -= 2

    j = 1
    while j < n:
        l.append(a[j])
        j += 2
else:
    i = n-1
    while i >= 0:
        l.append(a[i])
        i -= 2

    j = 0
    while j < n:
        l.append(a[j])
        j += 2

print(' '.join(map(str, l)))

Solution (Python):
from collections import deque
n=int(input())
a=[int(x) for x in input().rstrip().split()]

ans=deque()
for i in range(n):
  if (i+1)%2==1:
    ans.appendleft(str(a[i]))
  else:
    ans.append(str(a[i]))

ans=list(ans)
if n%2==0:
  print(*ans[::-1])
else:
  print(*ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
o = [a[i] for i in range(0,n,2)]
e = [a[h] for h in range(1,n,2)]
if n%2 == 0:
    e.reverse()
    l = e + o
    print(*l)
else:
    o.reverse()
    l = o + e
    print(*l)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
o = [a[i] for i in range(2,n,2)]
e = [a[h] for h in range(1,n,2)]
if n%2 == 0:
    e.reverse()
    l = e + [a[0]] + o
    print(*l)
else:
    o.reverse()
    l = o + [a[0]] + e
    print(*l)

Solution (Python):

import math
from collections import deque
n = int(input())

A = list(map(int,input().split()))
ans = 0
B = deque()
if n%2==0:
    for i in range(n):
        a=str(A[i])
        if i%2==1:
            B.appendleft(a)
        else:
            B.append(a)
if n%2==1:
    for i in range(n):
        a=str(A[i])
        if i%2==0:
            B.appendleft(a)
        else:
            B.append(a)
print(' '.join(B))

Solution (Python):
import sys
import math
from collections import deque


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
A = instrl()

B = deque()

if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            B.append(A[i])
        else:
            B.insert(0,A[i])
else:
    for i in range(n):
        if i % 2 == 0:
            B.insert(0,A[i])
        else:
            B.append(A[i])

print(" ".join(B))

Solution (Python):
from collections import deque
n = int(input())
A = list(map(int, input().split()))
B = deque()

for i in range(n):
    if i%2 == 0:
        B.append(A[i])
    else:
        B.appendleft(A[i])
B = list(B)        
if n%2 != 0:
    B = B[::-1]
print(*B)

Solution (Python):
from collections import deque
n=int(input())
a=list(map(int,input().split()))
b=deque()
if n%2==0:
    for i in range(n):
        if i%2==0:
            b.append(str(a[i]))
        else:
            b.appendleft(str(a[i]))
    print(" ".join(b))
else:
    for i in range(n):
        if i%2==0:
            b.appendleft(str(a[i]))
        else:
            b.append(str(a[i]))
    print(" ".join(b))

Solution (Python):
from collections import deque
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    A = nl()
    A = deque(A)
    B = deque()
    if n % 2 == 0:
        while A:
            B.append(A.popleft())
            B.appendleft(A.popleft())
        B = list(B)
        print(*B)
    else:
        while len(A) != 1:
            B.append(A.popleft())
            B.appendleft(A.popleft())
        B.append(A.popleft())
        B = list(B)[::-1]
        print(*B)


if __name__ == '__main__':
    main()

Solution (Python):

N = int(input())
N_List = list(map(str,input().split()))
if N % 2 == 0:
    ans = ' '.join(reversed(N_List[1::2])) + ' ' + ' '.join(N_List[::2])
else:
    ans = ' '.join(reversed(N_List[::2])) + ' ' + ' '.join(N_List[1::2])

print(ans)

Solution (Python):
from collections import deque


n = int(input())
a = list(map(int, input().split()))
b = deque()

for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.appendleft(a[i])

if n % 2:
    b.reverse()
    
print(*b)

Solution (Python):
from collections import deque

n = int(input())
a = deque(list(map(int, input().split())))
b = deque() if n % 2 == 0 else deque([a.popleft()])
for _ in range(n // 2):
    b.append(a.popleft())
    b.appendleft(a.popleft())
print(*b)

Solution (Python):
from collections import deque
n = int(input())
a = list(map(int,input().split()))
b = deque()
for i in range(n):
  if i%2==0:
    b.append(a[i])
  else:
    b.appendleft(a[i])
if n%2==0:
  print(*b)
else:
  print(*reversed(b))

Solution (Python):
from collections import deque
n=int(input())
a=list(map(int,input().split()))
b=deque()
for i in range(n):
  if i%2:
    b.appendleft(a[i])
  else:
    b.append(a[i])
if n%2:
  print(*reversed(list(b)))
else:
  print(*list(b))

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[N%2::2])

Solution (Python):
import collections
n,rev = int(raw_input()) ,False
class Node(object):
	def __init__(self, val):
		self.val = val
		self.next, self.prev = None, None

for i,ai in enumerate(map(int, raw_input().split())):
	node = Node(ai)		
	if i  == 0:
		head,tail = node,node
	else:
		if rev:
			head.prev, node.next = node, head
			head = node
		else:
			tail.next, node.prev = node, tail
			tail = node
		rev ^=  True

cur = head if not(rev) else tail  
while(cur):
	print cur.val, 
	cur = cur.next if not(rev) else cur.prev

Solution (Python):
import collections
n,rev,q = int(raw_input()) ,False,collections.deque()

class Node(object):
	def __init__(self, val):
		self.val = val
		self.next = None
		self.prev = None

head = None
tail = None
for ai in map(int, raw_input().split()):
	if head is None:
		node = Node(ai)
		head = node
		tail = node
	else:
		node = Node(ai)
		if rev:
			head.prev = node
			node.next= head
			head = node
		else:
			tail.next = node
			node.prev=  tail
			tail = node
		rev ^=  True

cur = head 
temp = []
while(cur):
	temp.append(cur.val)
	cur = cur.next 
print ' '.join(map(str, temp[::-1 if rev else 1]))

Solution (Python):
import collections
n,rev,q = int(raw_input()) ,False,collections.deque()

for ai in map(int, raw_input().split()):
	if rev: q.append(ai)
	else: q.appendleft(ai)
	rev ^= True

print ' '.join(map(str, list(q)[::1 if rev else -1]))

Solution (Python):
from collections import deque
q=deque()

n=int(input())
a=input().split()
for i in range(n):
    if i%2==0:
        q.append(a[i])
    else:
        q.appendleft(a[i])

if n%2==0:
    print(' '.join(q))
else:
    print(' '.join(list(q)[::-1]))

Solution (Python):
from collections import deque
n = int(input())
a = list(map(int, input().split()))
b = deque()
reverse = 1
for i in range(n):
    if reverse == 1:
        b.append(a[i])
        reverse *= -1
    else:
        b.appendleft(a[i])
        reverse *= -1

b_list = list(b)
if reverse == 1:
    print(*b_list)
else:
    print(*b_list[::-1])

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
ans = [0 for _ in range(N)]
l = 0
r = N - 1
flg = 1
for i in range(N - 1, -1, -1):
    if flg:
        flg = 0
        ans[l] = A[i]
        l += 1
    else:
        flg = 1
        ans[r] = A[i]
        r -= 1
print(*ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

even = [a[i] for i in range(1,n,2)]
odd = [a[i] for i in range(0,n,2)]

if n % 2 == 0:
  print(*(even[::-1]+odd))
else:
  print(*(odd[::-1]+even))

Solution (Python):
from collections import deque
n = int(input())
a = list(map(int, input().split()))

b = deque()

for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.appendleft(a[i])

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

print(" ".join(map(str, b)))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A_odd = A[1::2]
A_even = A[::2]
if N%2 !=0:
 A_even = A_even[::-1]
 ans = A_even + A_odd
 for s in ans:
  print(s, end =" ")
else:
 A_odd = A_odd[::-1]
 ans = A_odd + A_even
 for s in ans:
  print(s, end =" ")

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
    if n%2:
        if i==n//2:
            b[i]=a[0]
        elif i<n//2:
            b[i]=a[n-i*2-1]
        else:
            b[i]=a[(i-n//2)*2-1]
    else:
        if i<n//2:
            b[i]=a[n-i*2-1]
        else:
            b[i]=a[(i-n//2)*2]
print(' '.join(map(str,b)))

Solution (Python):
from collections import deque
import sys
input = sys.stdin.buffer.readline


n = int(input())
A = [int(i) for i in input().strip().split()]

b = deque()

flag = True

if n % 2 == 1:
    flag = False
for a in A:
    if flag:
        b.append(a)
    else:
        b.appendleft(a)
    flag = not flag

print(" ".join((str(s) for s in b)))

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    if N % 2 == 0:
        B = A[1::2]
        B.reverse()
        B += A[0::2]
    else:
        B = A[0::2]
        B.reverse()
        B += A[1::2]
    print(" ".join(map(str, B)))


if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b0=[]
b1=[]
for i in range(n):
  if i%2==0:
    b0.append(a[i])
  else:
    b1.append(a[i])
if n%2!=0:
  b0=list(reversed(b0))
  b=b0+b1
  print(' '.join(map(str, b)))
else:
  b1=list(reversed(b1))
  b=b1+b0
  print(' '.join(map(str, b)))

Solution (Python):
n = int(input())
A = list(map(int, input().split()))

from collections import deque
b = deque([])
for i, a in enumerate(A):
    if i % 2 == 0:
        b.append(a)
    else:
        b.appendleft(a)

if n % 2 == 0:
    print(*b)
else:
    print(*reversed(b))

Solution (Python):
n = int(input())
List = list(map(int,input().split()))
direction = 1
ahead = []
post = []
for i in range(n):
  if direction == 1:
    post.append(List[i])
  else:
    ahead.append(List[i])
  direction *= -1
if direction == 1:
  ans = ahead[::-1]+post
else:
  ans = post[::-1]+ahead
print(*ans)

Solution (Python):
n=int(input())
a=input().split()
if n%2:
  print(" ".join(a[::-2]+a[1::2]))
else:
  print(" ".join(a[-1:0:-2]+a[::2]))

Solution (Python):
from collections import deque
n = int(input())
a = list(map(int, input().split()))

q = deque()
t = 0
for i in a:
  if t == 0: q.append(i)
  else: q.appendleft(i)
  t = -1 - t
  
if t == 0: print(*q)
else: print(*reversed(q))

Solution (Python):
from collections import deque

N = int(input())
A = [int(c) for c in input().split()]
B = deque()

is_reversed = False
for a in A:
  if is_reversed:
    B.appendleft(a)
  else:
    B.append(a)
  is_reversed = not is_reversed

if is_reversed:
  ans = map(str, reversed(B))
else:
  ans = map(str, B)

print(' '.join(ans))

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
if n%2==0:
    print(' '.join([str(v) for v in l[1::2][::-1]+l[::2]]))
else:
    print(' '.join([str(v) for v in l[::2][::-1]+l[1::2]]))

Solution (Python):
n = int(input())
A = list(map(int, input().split()))

even = []
odd = []

for i in range(0, n, 2):
    even.append(A[i])
for i in range(1, n, 2):
    odd.append(A[i])

if (n-1) % 2 == 0:
    even.reverse()
    ans = even + odd
else:
    odd.reverse()
    ans = odd + even

print(*ans)

Solution (Python):
from collections import deque
def solve():
  N = int(input())
  A = list(map(int, input().split()))
  ans = deque([])
  for i in range(N):
    if i%2==0:
      ans.append(A[i])
    else:
      ans.appendleft(A[i])
  ans = list(ans)
  if N%2==1:
    ans = ans[::-1]
  return ans
print(*solve())

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

left = []
right = []

for i in range(n):
    if i % 2 == 0:
        left.append(a[i])
    else:
        right.append(a[i])
if n % 2 == 0:
    right.reverse()
    arr = right + left
    ans = " ".join(map(str, arr))
    print(ans)
else:
    left.reverse()
    arr = left + right
    ans = " ".join(map(str, arr))
    print(ans)

Solution (Python):
n = int(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))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
b = []
for i in a[-1::-2]:
    b.append(i)
for i in a[(n%2 == 1)::2]:
    b.append(i)
print(*b)

Solution (Python):
from collections import deque
n = int(input())
a = list(map(int,input().split()))
ans = deque()
for k in range(n):
    if k%2 == 0:
        ans.append(a[k])
    else:
        ans.appendleft(a[k])

if n%2 == 1:
    ans = list(ans)[::-1]
print(*ans)

Solution (Python):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))
from collections import deque

n=int(input())
a=lnii()

ans=deque([])
for i in range(n):
  if i%2==0:
    ans.appendleft(a[i])
  else:
    ans.append(a[i])

if n%2==0:
  ans=reversed(ans)

print(*list(ans))

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate 

from collections import deque,defaultdict,Counter
import decimal
import re












import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
d = deque()
flag = False
for i in range(n):
    if flag:
        d.appendleft(A[i])
    else:
        d.append(A[i])
    flag = ~flag
if flag:
    d = reversed(d)
print(*d)

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
if n%2==0:
    a = A[::2]
    b = A[1::2]
    b = b[::-1]
    print(*(b+a))
else:
    a = A[::2]
    a = a[::-1]
    b = A[1::2]
    print(*(a+b))

Solution (Python):
from collections import deque
n = int(input())
a = list(input().split())
ans = deque()
for i in range(n):
    if i%2==0: ans.append(a[i])
    else: ans.appendleft(a[i])
ans = list(ans)
if n%2==0:
    print(" ".join(ans))
else:
    print(" ".join(ans[::-1]))

Solution (Python):
from collections import deque
N = int(input())
A = list(map(int,input().split()))

b = deque()
for i,a in enumerate(A):
    if i%2:
        b.appendleft(a)
    else:
        b.append(a)

if N%2:
    print(*reversed(b))
else:
    print(*b)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

a1 = []
a2 = []

for i in range(n):
    if i % 2 == 0:
        a2.append(a[i])
    else:
        a1.append(a[i])


if n % 2 != 0:
    
    a2.reverse()
    res = a2 + a1

else:
    
    a1.reverse()
    res = a1 + a2

[print(x, end=" ") for x in res]
print()

Solution (Python):
n = int(input())
a = input().split()

if n & 1:
  print(' '.join(a[::-2]+a[1::2]))
else:
  print(' '.join(a[-1:0:-2]+a[::2]))

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]

A.reverse()
ans = []

for i in range(0,N,2):
    ans.append(A[i])

A.reverse()

for i in range(N%2,N,2):
    ans.append(A[i])

[print(i,end=' ') for i in ans]

Solution (Python):
N = int(input())
A = input().split()
L = A[1::2]
R = A[0::2]
if N%2==0:
    print(' '.join(L[::-1]+R))
else:
    print(' '.join(R[::-1]+L))

Solution (Python):
from collections import deque
N = int(input())
A = list(map(int, input().split()))
B = deque([])
c = 1
for a in A:
  if c:
    B.append(a)
  else:
    B.appendleft(a)
  c = 1-c
if N%2:
  B.reverse()
print(*B)

Solution (Python):
N=int(input())
A=list(input().split())
if N%2==0:
  B=A[::-1]
  print(' '.join(B[::2])+' ' + ' '.join(A[::2]))
else:
  B=A[::-1]
  A=A[1::2]
  print(' '.join(B[::2])+' ' + ' '.join(A[:]))

Solution (Python):
from collections import deque
def main():
    n=int(input())
    x=deque()
    r=False
    for i in map(int,input().split()):
        if r:
            x.appendleft(i)
        else:
            x.append(i)
        r = not r
    if r:
        x.reverse()
    print(*x)

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
a_lst = input().split()
odd = [a for i, a in enumerate(a_lst) if i % 2 != 0]
even = [a for i, a in enumerate(a_lst) if i % 2 == 0]

if n % 2 == 0:
  b = list(reversed(odd)) + even
else:
  b = list(reversed(even)) + odd
print(' '.join(b))

Solution (Python):
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())

    B = deque([])
    for i, a in enumerate(A):
        if i % 2 == N % 2:
            B.append(a)
        else:
            B.appendleft(a)

    print(*B)
    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())

    B = deque([])
    for i, a in enumerate(A):
        if i % 2 == 0:
            B.append(a)
        else:
            B.appendleft(a)

    if N % 2 != 0:
        B = reversed(B)

    print(*B)

    return


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

kisu=[]
gusu=[]
for x in range(n):
  if (x+1)%2==1:
    kisu.append(a[x])
  else:
    gusu.append(a[x])
    
if n%2==0:
  gusu.reverse()
  ans=gusu+kisu
  
else:
  kisu.reverse()
  ans=kisu+gusu
  
ans1=[str(f) for f in ans]

ans1=' '.join(ans1)

print(ans1)

Solution (Python):
import sys
from collections import deque
finput=lambda: sys.stdin.readline().strip()

n=int(finput())
a=finput().split()
b=deque()

for i in range(n):
  if (n-i)%2==0:
    b.append(a[i])
  else:
    b.appendleft(a[i])
print(' '.join(b))

Solution (Python):
n=int(input())
l=list(map(int, input().split()))
if n%2==0:
  for i in range(n-1, 0, -2):
    print(str(l[i]), end=' ')
  for i in range(0, n, 2):
    print(str(l[i]), end=' ')
else:
  for i in range(n-1, -1, -2):
    print(str(l[i]), end=' ')
  for i in range(1, n, 2):
    print(str(l[i]), end=' ')

Solution (Python):
from collections import deque
n = int(input())
A = deque(map(str, input().split()))
D = deque()
while A:
  x = A.popleft()
  D.append(x)
  if A:
    y = A.popleft()
    D.appendleft(y)
if n % 2 != 0:
  D.reverse()
print(" ".join(D))

Solution (Python):
n = int(input())
a = list(input().split())
b = []
a = a[::-1]
for i in range(n)[::2]:
    b.append(a[i])
a = a[::-1]
if n % 2 != 0:
    a.pop(0)
for i in range(len(a))[::2]:
    b.append(a[i])
print(' '.join(b))

Solution (Python):

n = int(input())
a = input().split()
ans = a[0::2][::-1] + a[1::2]
if n % 2:
    print(*ans)
else:
    print(*ans[::-1])

Solution (Python):
from collections import deque
n=int(input())
a=list(input().split())
b=deque()

for i in range(1,n+1):
  if (i%2==1 and n%2==0) or (i%2==0 and n%2==1):
    b.append(a[i-1])
  else:
    b.appendleft(a[i-1])
print(" ".join(b))

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
print(*A[::-2],*A[N%2::2])

Solution (Python):
from collections import deque
n = int(input())
A = deque(map(int, input().split()))
b = deque([])

if n%2==0:
    for i in range(n):
        if i%2 ==0:
            b.append(A[i])
        else:
            b.appendleft(A[i])
else:
    for i in range(n):
        if i%2 ==0:
            b.appendleft(A[i])
        else:
            b.append(A[i])            
print(*b)

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
head_s = [] 
back_s = []
n2 = 1
if n%2 == 0:
	n2 = 0
for h in range(n-1,-1,-2):
	head_s.append(a[h])
for b in range(n2,n,2):
	back_s.append(a[b])

ans_h = (' '.join(map(str,head_s)))
ans_b = (' '.join(map(str,back_s)))
print(ans_h,ans_b)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
r = []
l = []
for i in range(n):
  if i % 2 == 0:
    r.append(a[i])
  else:
    l.append(a[i])

if n % 2 == 0:
  ans = l[::-1]+r
else:
  ans = r[::-1]+l
print(" ".join(map(str, ans)))

Solution (Python):
from collections import deque

n = int(input())
a = list(map(int, input().split()))

res = deque()
for i in range(n):
    if i % 2 == 0:
        res.append(a[i])
    else:
        res.appendleft(a[i])

if n % 2 == 0:
    for i in range(n):
        print(res[i], end=' ')
else:
    for i in range(n-1, -1, -1):
        print(res[i], end=' ')

Solution (Python):
from collections import *
n = int(input())
a = [int(i) for i in input().split()]

b = deque()

b.append(a[0])
for i in range(1, n):
    if(i%2 == 1):
        b.append(a[i])  
    else:
        b.appendleft(a[i])
   

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

print(' '.join(map(str, b)))

Solution (Python):
def resolve():
    from collections import deque
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = deque()
    for i in range(N):
        if i % 2 == 0:
            ans.append(A[i])
        else:
            ans.appendleft(A[i])
    if i % 2 == 0:
        print(*list(ans)[::-1])
    else:
        print(*ans)


resolve()

Solution (Python):

n = int(input())
a = list(map(str,input().split()))

b = [""]*n
var = 0

if n % 2 == 0:
    for i in range(n):
        res = a[i]
        var += i*(-1)**i
        ind = n//2 + var
        b[ind] = res
else:
    for i in range(n):
        res = a[i]
        var += i*(-1)**i
        ind = n//2 - var
        b[ind] = res

ans = " ".join(b)
print(ans)