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):
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.appendleft(a[i])
    else:
        b.append(a[i])

if n%2==0:
    b=list(b)[::-1]

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==1:
    b = list(b)[::-1]
print(' '.join(list(map(str, b))))

Solution (Python):


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

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

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

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

from collections import deque

q = deque([])

for i in range(N):
  if i % 2:
    q.appendleft(A[i])
  else:
    q.append(A[i])
    
if N % 2:
  q = list(q)[::-1]
  
print(*q)

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

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

print(*b)

Solution (Python):
n,*a = map(int, open(0).read().split())
ans = [0] * n
for i in range(1,n+1):
    if i % 2 == 1:
        ans[i//2] = a[-i]
    else:
        ans[-(i//2)] = a[-i]
print(*ans)

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
B = [0] * n
j = n // 2
k = 1 if n % 2 == 1 else -1
for i in range(n):
    B[j] = A[i]
    j += k * (i + 1)
    k = -k
for i in range(n):
    print(str(B[i]) + ' ', end='')
print()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = [i for i in a[-1:: -2]] + [i for i in a[n%2: n: 2]]
print(" ".join(list(map(str, ans))))

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

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

X=[A[i] for i in range(0,N,2)]
Y=[A[i] for i in range(1,N,2)]

if N%2:
    A=X[::-1]
    B=Y
else:
    A=Y[::-1]
    B=X

print(" ".join(map(str,A+B)))

Solution (Python):
from collections import deque
n=int(input())
a=list(map(int,input().split()))
ans=deque()
rev=False
if n&1:
   rev=True 
for i in a:
    if rev:
        ans.appendleft(i)
    else:
        ans.append(i)
    rev=not rev
print(*ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
if N%2==0:
  B = [A[i] for i in range(N) if i%2==0]
  C = [A[(N-i-1)] for i in range(N) if (N-i-1)%2==1]
  print(*C+B)
else:
  B = [A[i] for i in range(N) if i%2==1]
  C = [A[(N-i-1)] for i in range(N) if (N-i-1)%2==0]
  print(*C+B)

Solution (Python):
from collections import deque
d = deque()
N = int(input())
array = list(map(int,input().split()))
for i in range(N):
    if i%2==0:
        d.appendleft(array[i])
    else:
        d.append(array[i])
if N%2==0:
    d = reversed(d)
ans = ' '.join(map(str,d))
print(ans)

Solution (Python):
from collections import deque
n = int(input())
a_list = [int(x) for x in input().split()]
left_flag = n % 2 == 1
d = deque()
for a in a_list:
    if left_flag:
        d.appendleft(a)
    else:
        d.append(a)
    left_flag = not left_flag
print(*d)

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())

from collections import deque
Q = deque()
for i, a in enumerate(As):
    if i%2==0:
        Q.append(a)
    else:
        Q.appendleft(a)

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

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(*ans)

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

flag = True

for x in a:
    if flag:
        b.append(x)
        flag = False
    else:
        b.appendleft(x)
        flag = True
if flag:
    print(*b)
else:
    print(*list(b)[::-1])

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

if n % 2 == 0:
    lis1 = a[::2]
    lis2 = a[::-2]
    ans = lis2 + lis1
else:
    lis1 = a[::-2]
    lis2 = a[1::2]
    ans = lis1 + lis2
ans = map(str, ans)
print(' '.join(ans))

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

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

Solution (Python):
from collections import deque
N = int(input())
A = [int(a) for a in input().split()]

q = deque()
for i in range(N):
    if i%2 == 0:
        q.append(A[i])
    else:
        q.appendleft(A[i])

ans = list(q)
if N%2 == 1:
    ans.reverse()
print(*ans)

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

Q = deque([])
for i in range(N):
  if i%2 ==0 :
    Q.append(A[i])
  else:
    Q.appendleft(A[i])

if N%2 == 0:
  print(*Q)
else:
  Q.reverse()
  print(*Q)

Solution (Python):
from collections import deque

def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  d = deque()
  for i in range(n):
    if i % 2 == 0:
      d.append(a[i])
    else:
      d.appendleft(a[i])
  while len(d) > 0:
    if n % 2 == 0:
      print(d.popleft(), end=' ')
    else:
      print(d.pop(), end=' ')
  print('')
  return

if __name__ == "__main__":
  resolve()

Solution (Python):
import sys
from collections import defaultdict, deque, Counter
import math


from bisect import bisect_left, bisect_right
import heapq




input = sys.stdin.readline

getS = lambda: input().strip()
getN = lambda: int(input())
getList = lambda: list(map(int, input().split()))
getZList = lambda: [int(x) - 1 for x in input().split()]

INF = 10 ** 20
MOD = 10**9 + 7
divide = lambda x: pow(x, MOD-2, MOD)


def nck(n, k, kaijyo):
    return (npk(n, k, kaijyo) * divide(kaijyo[k])) % MOD


def npk(n, k, kaijyo):
    if k == 0 or k == n:
        return n % MOD
    return (kaijyo[n] * divide(kaijyo[n-k])) % MOD


def kaijyo(n):
    ret = [1]
    for i in range(1, n + 1):
        ret.append((ret[-1] * i)% MOD)
    return ret

def solve():
    nn = getN()
    n = getList()
    d = deque()
    for i, num in enumerate(n):
        if i % 2 == 0:
            d.append(num)
        else:
            d.appendleft(num)

    if len(n) % 2 == 1:
        d.reverse()
    
    print(*list(d))

def main():
    n = getN()
    for _ in range(n):
        solve()


if __name__ == "__main__":
    
    solve()

Solution (Python):
n=int(input())
a=list(input().split())
if n > 3:
    ans=''
    ans += ' '.join(a[::-2])
    if n%2==0:
        ans += ' ' + ' '.join(a[0::2])
    else:
        ans += ' ' + ' '.join(a[1::2])
    print(ans)
else:
    ans=[]
    for i in range(n):
        ans.append(a[i])
        ans.reverse()
    print(' '.join(ans))

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

B_even = deque([A[0]])
if N > 1:
    B_add = deque([A[1],A[0]])

for a_idx in range(2,len(A)):
    if a_idx % 2 == 0 :
        B_even.appendleft(A[a_idx])
        B_even.append(A[a_idx-1])
    else:
        B_add.appendleft(A[a_idx])
        B_add.append(A[a_idx-1])
        
if (N-1) % 2 ==0:
    B = B_even
else:
    B = B_add
    
print(' '.join(map(str,B)))

Solution (Python):
from collections import deque

n = int(input())
A = list(input().split())
B= deque()

for i in range(n):
  if i % 2:
    B.append(A[i])
  else:
    B.appendleft(A[i])
  
if n % 2 == 0:
  B.reverse()
  
print(" ".join(B))

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
x = []
y = []
for i in range(len(a)):
    if i%2==0:
        x.append(str(a[i]))
    else:
        y.append(str(a[i]))
if n%2==1:
    x = x[::-1]
    print(' '.join(x+y));exit()
else:
    y = y[::-1]
    print(' '.join(y+x));exit()

Solution (Python):
from collections import deque


def main():
    n = int(input())
    As = list(map(int, input().split()))
    left = deque([])
    right = deque([])
    if n % 2 == 0:
        for i in range(n):
            if i % 2 == 0:
                right.append(As[i])
            else:
                left.appendleft(As[i])
    else:
        for i in range(n):
            if i % 2 == 0:
                left.appendleft(As[i])
            else:
                right.append(As[i])

    left.extend(right)
    print(*left)


if __name__ == "__main__":
    main()

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

b = a[1::2][::-1]+a[::2]
if len(a)%2==0:
    print(' '.join(b))
else:
    print(' '.join(b[::-1]))

Solution (Python):

import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd





def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    b = deque()
    for i in range(n):
        if i % 2:
            b.appendleft(a[i])
        else:
            b.append(a[i])
    if n % 2:
        b.reverse()
    print(*b)


t = 1

for case in range(1,t+1):
    ans = solve()


"""

abc

"""

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

    q = deque()
    for i in range(n):
        if i % 2 == 0:
            q.append(A[i])
        else:
            q.appendleft(A[i])
    
    ans = list(q)
    if n % 2 != 0:
        ans.reverse()
    
    print(*ans)

if __name__ == '__main__':
    solve()

Solution (Python):
from collections import deque

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

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

Solution (Python):
from collections import deque

n = int(input())
a = [int(i) for i in 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(*list(b))

Solution (Python):
n = int(input())
a = input().split()
ar = list(reversed(a))
ans = []
if not n % 2:
  for i in range(0, n, 2):
    ans.append(ar[i])

  for i in range(0, n, 2):
    ans.append(a[i])

  print(' '.join(ans))
else:
  for i in range(0, n, 2):
    ans.append(ar[i])

  for i in range(1, n, 2):
    ans.append(a[i])

  print(' '.join(ans))

Solution (Python):
import collections

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

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

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

print(" ".join([str(x) for x in b]))

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

left = []
right = []

if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            right.append(a[i])
        else:
            left.append(a[i])
    
    print(*(left[::-1]+right))
else:
    for i in range(n):
        if i % 2 == 0:
            left.append(a[i])
        else:
            right.append(a[i])
    
    print(*(left[::-1]+right))

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

left = []
right = []

if n % 2 == 0:
    for i in range(n):
        if i % 2 == 0:
            right.append(a[i])
        else:
            left.append(a[i])
    
    print(*(left[::-1]+right))
else:
    for i in range(n):
        if i % 2 == 0:
            left.append(a[i])
        else:
            right.append(a[i])
    
    print(*(left[::-1]+right))

Solution (Python):
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

n = readInt()
a = readInts()

if len(a)%2==0:
	for i in range(len(a)-1,0,-2):
		print(a[i], end=" ")
	for i in range(0,len(a),2):
		print(a[i], end=" ")
else:
	for i in range(len(a)-1,-1,-2):
		print(a[i], end=" ")
	for i in range(1,len(a),2):
		print(a[i], end=" ")

Solution (Python):






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





if n%2 == 0:
    ans = list(reversed([a[i] for i in range(n) if i%2 != 0]))
    ans += [a[i] for i in range(n) if i%2 == 0]
else:
    ans = list(reversed([a[i] for i in range(n) if i%2 == 0]))
    ans += [a[i] for i in range(n) if i%2 != 0]
print(*ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
if n % 2 == 0:
  l_1 = [a[n-1-2*i] for i in range(n//2)]
  l_2 = [a[2*i] for i in range(n//2)]
else:
  l_1 = [a[n-1-2*i] for i in range((n+1)//2)]
  l_2 = [a[2*i+1] for i in range(n//2)]
print(*l_1, *l_2)

Solution (Python):
import sys
input = sys.stdin.readline


def read():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    return N, A


def solve(N, A):
    B = [0 for a in A]
    mid = N // 2
    for i in range(0, N, 2):
        B[mid+i//2] = A[i]
    for i in range(1, N, 2):
        B[mid-(i+1)//2] = A[i]
    if N % 2 == 1:
        print(*B[::-1])
    else:
        print(*B)


if __name__ == '__main__':
    inputs = read()
    solve(*inputs)

Solution (Python):
def resolve():
    '''
    code here
    '''
    import collections
    n = int(input())
    As = collections.deque([int(item) for item in input().split()])
    bs = collections.deque()

    for i in range(n):
        if i % 2 == 0:
            bs.append(As.popleft())
        else:
            bs.appendleft(As.popleft())
    res =list(bs)
    if n % 2 == 1:
        res.reverse()

    print(*res)




if __name__ == "__main__":
    resolve()

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

ans = deque([])
t = 0
for i in a:
  if t == 0: ans.append(i)
  else: ans.appendleft(i)
  t = 1 - t

if t == 0: print(*ans)
else: print(*reversed(ans))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ans=[]
def ap(num1):
    ans.append(num1)
if n%2==0:
    num=n-1
    for i in range(n//2):
        ap(a[num])
        num-=2
    num=0
    for i in range(n//2):
        ap(a[num])
        num+=2
else:
    num=n-1
    for i in range(n//2+1):
        ap(a[num])
        num-=2
    num=1
    for i in range(n//2):
        ap(a[num])
        num+=2
print(*ans)

Solution (Python):
import sys
from collections import deque
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    n = ii()
    a = list(mi())
    d = deque()
    for i in range(n):
        if i%2:
            d.appendleft(a[i])
        else:
            d.append(a[i])
    print(*list(d)[::((-1)**(n%2))])


if __name__ == '__main__':
    main()

Solution (Python):
from collections import deque

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

res = deque()
for i in range(0, N-1, 2):
    res.append(A[i])
    res.appendleft(A[i+1])

if N % 2 == 1:
    res.append(A[N-1])
    print(" ".join(reversed([str(s) for s in res])))
else:
    print(" ".join(str(s) for s in res))

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

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

print(" ".join(q))

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

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

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

even=deque()
odd=deque()

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

ans=[]
while(len(odd)>0):
    ans.append(odd.pop())

while(len(even)>0):
    ans.append(even.popleft())

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

print(*ans)

Solution (Python):
from collections import deque
n = int(input())
A = deque(map(str, input().split()))
B = deque()
cycle = n % 2
for a in A:
    if cycle % 2 == 1:
        B.appendleft(a)
    else:
        B.append(a)
    cycle += 1
print(' '.join(B))

Solution (Python):
import sys
import math
import itertools
import bisect
from copy import copy,deepcopy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(map(int,input().split()))
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

n = i()
a = l()
deq = deque([])
for i in range(n):
    if i%2 == 0:
        deq.append(a[i])
    else:
        deq.appendleft(a[i])
if n%2 == 1:
    deq.reverse()
print(*deq)

Solution (Python):
from collections import deque
n = int(input())
a = list(map(int, input().split()))
Q = deque(a)
b = deque()
i = 1
while Q:
    q = Q.popleft()
    if i == 0:
        b.appendleft(q)
        i = 1
    else:
        b.append(q)
        i = 0
if n % 2 == 0:
    for bi in b:
        print(bi, end=' ')
    print('')
else:
    for bi in reversed(b):
        print(bi, end=' ')
    print('')

Solution (Python):
N=int(input())
*A,=map(int,input().split())
A=A[::-1]
B=[0]*N

i=1
count=0
while count<N:
    if count%2==0:
        B[i-1]=A[count]
    else:
        B[-i]=A[count]
        i+=1
    count+=1

print(*B)

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

Solution (Python):
import math
import collections
import fractions
import itertools

def solve():
    n = int(input())
    a = list(map(int, input().split()))
    deq = collections.deque()
    for i in range(n):
        if i % 2 == 0:
            deq.append(str(a[i]))
        else:
            deq.appendleft(str(a[i]))
    if n % 2 == 1:
        deq.reverse()
    print(" ".join(deq))
    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
from collections import deque

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

d = deque()
for i, value in enumerate(a, start=1):
    if n % 2 == i % 2:
        d.appendleft(value)
    else:
        d.append(value)

for value in d:
    print(f'{value} ', end="")
print()
exit()

Solution (Python):
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
a = LI()
b = []
iodd = a[::2]
ieven = a[1::2]
if n % 2 == 0:
    b = ieven[::-1] + iodd
else:
    b = iodd[::-1] + ieven
print(*b)

Solution (Python):
from collections import deque

n = int(input())
a_li = list(map(int, input().split()))
b_li = deque()
for i in range(len(a_li)):
    if i % 2 == 0:
        b_li.append(a_li[i])
    else:
        b_li.appendleft(a_li[i])

if len(a_li) % 2 == 0:
    print(*b_li)
else:
    print(*list(b_li)[::-1])

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
dp=[0]*n
i,j,k=1,1,0
p=n//2
dp[p]=a[0]
if n%2==0:
  while i+j-1!=n:
    if k%2==0:
      dp[p-i]=a[i+j-1]
      i+=1
      k=1
    else:
      dp[p+j]=a[i+j-1]
      j+=1
      k=0
  print(*dp)
else:
  while i+j-1!=n:
    if k%2==0:
      dp[p+i]=a[i+j-1]
      i+=1
      k=1
    else:
      dp[p-j]=a[i+j-1]
      j+=1
      k=0
  print(*dp)

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

Solution (Python):
import bisect,copy,heapq,itertools,math,string
from collections import *
import sys
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = LIST()
b = deque()

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

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

c = [a[b[i]] for i in range(n)]
print(*c)

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

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

left=[]
right=[]
if n%2!=0:
    for i in range(0,n,2):
        left.append(a[n-i-1])
    for i in range(1,n,2):
        right.append(a[i])
else:
    for i in range(0,n,2):
        left.append(a[n-i-1])
    for i in range(0,n,2):
        right.append(a[i])


ans=left
ans.extend(right)
L=[str(a) for a in ans]
L=" ".join(L)
print(L)

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

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

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.appendleft(a[i])
    else:
        b.append(a[i])
if n % 2 == 0:
    print(*reversed(b))
else:
    print(*b)

Solution (Python):
n = int(input())
a = list(input().split())
num = list(range(n-1,-(n-1)-2,-2) )
for i in range(len(num)):
    if num[i]<0:
        num[i] = abs(num[i]+1)
    print(a[num[i]], end = ' ')

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

for a in range(N):
    if a % 2 == 0:
        d.append(A[a])
    else:
        d.appendleft(A[a])

if N % 2 == 0:
    print(*d)
else:
    d.reverse()
    print(*d)

Solution (Python):
n = int(input())
A = tuple(map(int, input().split()))
ae = A[::2]
ao = A[1::2]

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

Solution (Python):


import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def a_int(): return int(read())


def ints(): return list(map(int, read().split()))


from collections import deque

n = a_int()
A = ints()
B = deque()
is_fliped = 0
for a in A:
    if is_fliped == 0:
        B.append(a)
    else:
        B.appendleft(a)
    is_fliped = 1 - is_fliped
if is_fliped:
    B.reverse()
print(*B)

Solution (Python):

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

d = deque()

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

result = list(d)
if n % 2 == 1:
    result = reversed(list(d))
print(*result)

Solution (Python):
import sys, os, math, bisect, itertools, collections, heapq, queue

from decimal import Decimal
from collections import defaultdict



sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    if N % 2 == 0:
        print(*A[1::2][::-1], *A[::2])
    else:
        print(*A[::2][::-1], *A[1::2])


if __name__ == '__main__':
    main()

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

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(*b)
else:
    print(*b)

Solution (Python):
from collections import deque

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

d = deque()

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

if N % 2 != 0:
    d.reverse()
print(*d)

Solution (Python):
from collections import deque

n=int(input())
a=[0]+list(map(int, input().split()))

b=deque()

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

ans=[]

for elem in b:
    ans.append(elem)

print(*ans)

Solution (Python):
from collections import deque

n=int(input())
a=[0]+list(map(int, input().split()))

b=deque()

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

ans=[]

for elem in b:
    ans.append(elem)

print(*ans)

Solution (Python):
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque
n = int(input())
a = list(map(int,input().split()))
b = deque()


rev = False
for i in a:
    if rev:
        b.appendleft(i)
    else:
        b.append(i)
    rev = not rev

if rev:
    b.reverse()

for i in b:
    print(i)

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 = list(B)[::-1]
        
print(*B)

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

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

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

if n % 2 == 1:
   b = odd[::-1]
   b.extend(even)
else:
   b = even[::-1]
   b.extend(odd)
print(*b)

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


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

print(*b)

Solution (Python):
from collections import deque


B = deque()
n = int(input())
A = list(map(int, input().split()))

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

if n % 2 == 1:
    B.reverse()
print(*B)

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


for i in range(n):
    if (i < 2):
        d.append(str(L[i]))
    else:
        if (i % 2 == 0):
            d.appendleft(str(L[i]))
        else:
            d.append(str(L[i]))

if (len(d) % 2 == 0):
    d.reverse()
    print(' '.join(d))
else:
    print(' '.join(d))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans1 = list(range(1, n+1, 2))
ans2 = list(range(2, n+1, 2))
if n % 2 == 0:
    ans2.reverse()
    ans = ans2 + ans1
else:
    ans1.reverse()
    ans = ans1 + ans2
for i in ans:
    print(a[i-1])

Solution (Python):
def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    ans = []
    if n%2 == 0:
        for i in range(n//2):
            ans.append(a[(-i*2)-1])
        for j in range(n//2):
            ans.append(a[(j*2)])
    else:
        for i in range(n//2+1):
            ans.append(a[(-i*2)-1])
        for j in range(n//2):
            ans.append(a[(j*2)+1])
    print(*ans)
resolve()

Solution (Python):
n, *a = map(int, open(0).read().split())
print(*(a[::-2] + a[n%2::2]))

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ushiro=list()
mae=list()
for i in range(n):
    if i%2:
        mae.append(a[i])
    else:
        ushiro.append(a[i])
p=ushiro[::-1]+mae if n%2 else mae[::-1]+ushiro
print(*p)

Solution (Python):
n=int(input())
a=list(input().split())
if n%2==0:  
  b=a[::2]
  a.pop(0)
  c=a[::2]
  c.reverse()
  print(' '.join(c+b))
else:
  b=a[::2]
  a.pop(0)
  c=a[::2]
  b.reverse()
  print(' '.join(b+c))

Solution (Python):



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

from collections import deque,defaultdict,Counter











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()
dq = deque()
for i in range(n):
    if i%2:
        dq.appendleft(A[i])
    else:
        dq.append(A[i])
if n%2:
    dq = list(dq)[::-1]
print(*dq)