Polycarp has a favorite sequence $a[1 \dots n]$ consisting of $n$ integers. He wrote it out on the whiteboard as follows:

he wrote the number $a_1$ to the left side (at the beginning of the whiteboard);

he wrote the number $a_2$ to the right side (at the end of the whiteboard);

then as far to the left as possible (but to the right from $a_1$), he wrote the number $a_3$;

then as far to the right as possible (but to the left from $a_2$), he wrote the number $a_4$;

Polycarp continued to act as well, until he wrote out the entire sequence on the whiteboard.

The beginning of the result looks like this (of course, if $n \ge 4$).

For example, if $n=7$ and $a=[3, 1, 4, 1, 5, 9, 2]$, then Polycarp will write a sequence on the whiteboard $[3, 4, 5, 2, 9, 1, 1]$.

You saw the sequence written on the whiteboard and now you want to restore Polycarp's favorite sequence.


-----Input-----

The first line contains a single positive integer $t$ ($1 \le t \le 300$) — the number of test cases in the test. Then $t$ test cases follow.

The first line of each test case contains an integer $n$ ($1 \le n \le 300$) — the length of the sequence written on the whiteboard.

The next line contains $n$ integers $b_1, b_2,\ldots, b_n$ ($1 \le b_i \le 10^9$) — the sequence written on the whiteboard.


-----Output-----

Output $t$ answers to the test cases. Each answer — is a sequence $a$ that Polycarp wrote out on the whiteboard.


-----Examples-----

Input
6
7
3 4 5 2 9 1 1
4
9 2 7 1
11
8 4 3 1 2 7 8 7 9 4 2
1
42
2
11 7
8
1 1 1 1 1 1 1 1
Output
3 1 4 1 5 9 2 
9 1 2 7 
8 2 4 4 3 9 1 7 2 8 7 
42 
11 7 
1 1 1 1 1 1 1 1


-----Note-----

In the first test case, the sequence $a$ matches the sequence from the statement. The whiteboard states after each step look like this:

$[3] \Rightarrow [3, 1] \Rightarrow [3, 4, 1] \Rightarrow [3, 4, 1, 1] \Rightarrow [3, 4, 5, 1, 1] \Rightarrow [3, 4, 5, 9, 1, 1] \Rightarrow [3, 4, 5, 2, 9, 1, 1]$.

Difficulty: EASY
Tags: Amortized analysis

Implementation
Skill types: Amortized analysis

Starter code:

Solutions:
import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	b = [*map(int, input().split())]
	x = 1
	y = 0
	ns = []
	for a in range(n):
		if y == 0:
			ns.append(b[x - 1])
			y = 1
		else:
			ns.append(b[-x])
			x += 1
			y = 0
	print(*ns)


t = int(input())
import math
for T in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	answer = []
	j = 0
	for i in range(math.ceil(n / 2)):
		answer.append(a[i])
		if i != n - 1 - i:
			answer.append(a[n - 1 - i])
	print(*answer)


n = int(input())
while n:
	n -= 1
	l = int(input())
	arr = input().split()
	t = []
	i = 0
	j = l - 1
	while i < j:
		t.append(arr[i])
		t.append(arr[j])
		i += 1
		j -= 1
	if l % 2:
		t.append(arr[l // 2])
	print(' '.join(t))


t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	i = 0
	j = len(lst) - 1
	s = [0] * len(lst)
	for k in range(len(lst)):
		if k % 2 == 0:
			s[k] = lst[i]
			i += 1
		else:
			s[k] = lst[j]
			j -= 1
	for i in range(len(s)):
		print(s[i], ' ', end='')


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


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	l = 0
	r = n - 1
	b = []
	f = 1
	while l <= r:
		if f == 1:
			b.append(a[l])
			l += 1
			f = 0
		else:
			b.append(a[r])
			r -= 1
			f = 1
	print(*b)


def unravel(length, seq):
	result = []
	left = 0
	right = length - 1
	while left <= right:
		if left == right:
			result.append(seq[left])
			return result
		result.extend([seq[left], seq[right]])
		left += 1
		right -= 1
	return result
num_cases = int(input())
for case in range(num_cases):
	curr_length = int(input())
	curr_seq = list(map(int, input().split()))
	print(' '.join((str(e) for e in unravel(curr_length, curr_seq))))


t = int(input())
s = 1
while s <= t:
	n = int(input())
	cookie = []
	choco = [int(x) for x in input().split()]
	if len(choco) % 2 == 0:
		en = len(choco) // 2
	else:
		en = (len(choco) - 1) // 2
	for i in range(0, en + 1):
		if len(cookie) < n:
			cookie.append(choco[i])
		if len(cookie) < n:
			cookie.append(choco[len(choco) - 1 - i])
	for i in cookie:
		print(i, end=' ')
	print()
	s += 1


def firstFunction():
	nums = []
	n = int(input())
	for x in range(n):
		nums.append(int(input()))
	for x in nums:
		print(x, end=' ')

def suma():
	(x, y) = input().split()
	[x, y] = [int(x), int(y)]
	print(x + y)

def diferenta():
	(x, y) = input().split()
	[x, y] = [int(x), int(y)]
	print(abs(x - y))

def favorite_Sequence():
	t = int(input())
	rez = []
	for k in range(t):
		n = int(input())
		nums = input().split()
		r = []
		right = n - 1
		left = 0
		for i in range(n):
			if i % 2 == 0:
				r.append(nums[left])
				left += 1
			else:
				r.append(nums[right])
				right -= 1
		rez.append(r)
	for x in rez:
		for y in x:
			print(y, end=' ')
		print()
favorite_Sequence()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()[:n]))
	arr1 = [0] * n
	i = 0
	if n % 2 != 0:
		for j in range(0, n, 2):
			arr1[j] = arr[i]
			i += 1
		for k in range(n - 2, 0, -2):
			arr1[k] = arr[i]
			i += 1
	else:
		for j in range(0, n, 2):
			arr1[j] = arr[i]
			i += 1
		for k in range(n - 1, 0, -2):
			arr1[k] = arr[i]
			i += 1
	print(*arr1)


t = int(input())
from math import *
count = 0

def f(n, arr, val, i):
	if val == 0:
		return True
	if n == 0 or val < 0:
		return False
	if arr[i] > val:
		return f(n - 1, arr, val, i + 1)
	return f(n - 1, arr, val, i + 1) or f(n - 1, arr, val - arr[i], i + 1)

def g(lp, k, n, arr, lpp):
	global count
	if k == 0 and n == 0:
		count += 1
		if count == 1:
			print(''.join(arr))
		return True
	if n == 0:
		return False
	if k < 0:
		return False
	if lp < lpp + 1:
		arr.append(chr(97 + lp))
		if not g(lp, k - 2 ** lp, n - 1, arr, lpp) and len(arr) > 0:
			arr.pop()
		else:
			return True
	if lp < lpp:
		g(lp + 1, k, n, arr, lpp)
	return False
for i in range(t):
	n = int(input())
	arrs = [int(x) for x in input().strip().split()]
	arr = []
	i = 0
	j = n - 1
	k = 0
	while k < n:
		if k % 2 == 0:
			arr.append(arrs[i])
			i += 1
		else:
			arr.append(arrs[j])
			j -= 1
		k += 1
	print(' '.join([str(x) for x in arr]))


n = int(input())
while n > 0:
	z = int(input())
	x = input().split(' ')
	new = ['0'] * z
	new[0] = int(x[0])
	count = 0
	for i in range(0, z, 2):
		new[i] = x[count]
		count += 1
	count = z - 1
	for i in range(1, z, 2):
		new[i] = x[count]
		count -= 1
	print(' '.join(new))
	n -= 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = []
	for i in range(n):
		if i % 2 == 0:
			ans.append(l[i // 2])
		else:
			ans.append(l[-((i + 1) // 2)])
	print(*ans)


n = int(input())
for i in range(n):
	k = int(input())
	li = input().split(' ')
	res = li[0]
	l = 1
	r = k - 1
	while l < r:
		res += ' ' + li[r]
		res += ' ' + li[l]
		l += 1
		r -= 1
	if l == r:
		res += ' ' + li[l]
	print(res)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	p1 = 0
	p2 = len(a) - 1
	while p1 < p2:
		print(a[p1], a[p2], end=' ')
		p1 += 1
		p2 -= 1
	if n % 2 != 0:
		print(a[n // 2])


from sys import *
ws = lambda : map(int, stdin.readline().strip().split())
li = lambda : list(map(int, stdin.readline().strip().split()))
mod = 1000000007

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def prod(l):
	ans = 1
	for i in range(len(l)):
		ans = ans * l[i]
	return ans

def sortindex(l, a):
	c = []
	if a == -1:
		rev = True
	else:
		rev = False
	for i in range(len(l)):
		c.append([l[i], i])
	x = sorted(c, reverse=rev)
	print(x)
	c = []
	for i in range(len(l)):
		c.append(x[i][1])
	return c

def modInverse(a, m):
	g = gcd(a, m)
	if g != 1:
		return -1
	else:
		return pow(a, m - 2, m)
for _ in range(int(input())):
	n = int(input())
	seq = li()
	first = []
	if n & 1:
		first.append(seq[0])
		for i in range((n - 1) // 2):
			first.append(seq[-(i + 1)])
			first.append(seq[i + 1])
	else:
		for i in range(n // 2):
			first.append(seq[i])
			first.append(seq[-(i + 1)])
	print(*first)


for _ in range(int(input())):
	n = int(input())
	a = input().split()
	ans = []
	half = n // 2
	for i in range(half):
		ans.append(a[i])
		ans.append(a[n - 1 - i])
	if n % 2 != 0:
		ans.append(a[half])
	print(' '.join(ans))


for i in range(int(input())):
	junk = input()
	arr = input().split()
	ans = ['0' for i in range(len(arr))]
	i = j = 0
	while True:
		if i + 1 < len(ans):
			ans[i] = arr[j]
			ans[i + 1] = arr[len(arr) - 1 - j]
		else:
			break
		i += 2
		j += 1
	if len(arr) % 2 != 0:
		ans[-1] = arr[len(arr) // 2]
	print(' '.join(ans))


for i in range(int(input())):
	lenn = int(input())
	list1 = list(map(int, input().split()))
	output = ''
	count = 0
	if lenn == 1:
		print(list1[0])
	elif lenn % 2 == 0:
		for i in range(1, lenn):
			output += str(list1[i - 1]) + ' ' + str(list1[-i]) + ' '
			count += 2
			if count == lenn:
				print(output)
				break
			elif count > lenn:
				print(output[:-3])
				break
	else:
		for i in range(1, lenn // 2 + 1):
			output += str(list1[i - 1]) + ' ' + str(list1[-i]) + ' '
			count += 2
			if count == lenn - 1:
				print(output + str(list1[lenn // 2]))
				break


caseNum = int(input())
cases = [0] * caseNum
lengths = [0] * caseNum
for i in range(caseNum):
	lengthIn = int(input())
	lengths[i] = lengthIn
	arrayIn = input()
	cases[i] = arrayIn.split()
for testNum in range(len(cases)):
	indx = 0
	for i in range(lengths[testNum]):
		if i % 2 == 0:
			print(cases[testNum][indx], end=' ')
		else:
			print(cases[testNum][lengths[testNum] - 1 - indx], end=' ')
			indx += 1
	print()


def getCases():
	cases = []
	t = int(input())
	for case in range(t):
		n = int(input())
		seq = list(map(int, input().strip().split()))[:n]
		cases.append(seq)
	return cases

def solve(seq):
	res = [seq.pop(0)]
	while seq:
		res.append(seq.pop())
		if seq:
			res.append(seq.pop(0))
	return res
for case in getCases():
	res = solve(case)
	for num in res:
		print(num, end=' ')
	print()


T = int(input())
for t in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	res = []
	p = 0
	q = N - 1
	while len(res) < len(A):
		if len(res) % 2 == 0:
			res.append(str(A[p]))
			p += 1
		else:
			res.append(str(A[q]))
			q -= 1
	print(' '.join(res))


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	b = input().split()
	i = 0
	j = len(b) - 1
	res = []
	while i < j:
		res.append(b[i])
		res.append(b[j])
		i += 1
		j -= 1
	if i == j:
		res.append(b[i])
	ans.append(res)
for a in ans:
	print(' '.join(a))


for _ in range(int(input())):
	n = int(input())
	data = list(map(int, input().strip().split()))
	answer = []
	left = 0
	right = len(data) - 1
	while left <= right:
		if left == right:
			answer.append(data[left])
		else:
			answer.append(data[left])
			answer.append(data[right])
		left += 1
		right -= 1
	print(*answer)


t = int(input())
for gg in range(t):
	n = int(input())
	k = []
	l = list(map(int, input().strip().split()))
	if n % 2 == 0:
		c = n // 2
	else:
		c = n // 2 + 1
	for i in range(c):
		if i >= n - i - 1:
			k.append(l[i])
			break
		else:
			k.append(l[i])
			k.append(l[n - i - 1])
	for i in k:
		print(i, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	lista = list(map(int, input().split()))
	x = 0
	i = 0
	j = n - 1
	res = ''
	while x < n:
		if x == 0 or x % 2 == 0:
			res += str(lista[i]) + ' '
			i += 1
		else:
			res += str(lista[j]) + ' '
			j -= 1
		x += 1
	print(res)


for i in range(0, int(input())):
	n = int(input())
	alist = list(map(int, input().split()))
	if n % 2 == 0:
		outlist = []
		for ele in range(0, int(len(alist) / 2)):
			outlist.append(alist[ele])
			outlist.append(alist[-(ele + 1)])
	else:
		outlist = []
		for ele in range(0, int((len(alist) - 1) / 2)):
			outlist.append(alist[ele])
			outlist.append(alist[-(ele + 1)])
		outlist.append(alist[int((len(alist) - 1) / 2)])
	print(*outlist)


for i in range(int(input())):
	n = int(input())
	ls = list(map(int, input().split()))
	sequence = []
	for i in range(len(ls) // 2):
		sequence.append(ls[i])
		sequence.append(ls[-i - 1])
	if len(ls) % 2 == 0:
		print(' '.join(map(str, sequence)))
	else:
		sequence.append(ls[len(ls) // 2])
		print(' '.join(map(str, sequence)))


t = int(input())
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = []
	l = 0
	r = n - 1
	while l <= r:
		for i in range(n):
			if i % 2 == 0:
				c.append(a[l])
				l += 1
			else:
				c.append(a[r])
				r -= 1
	b = ' '.join(map(str, c))
	print(b)


import sys

def polySecuence(arr):
	secuen = []
	final = ''
	right = len(arr) - 1
	left = 0
	while left < right:
		secuen.append(arr[left])
		secuen.append(arr[right])
		left += 1
		right -= 1
	if len(arr) % 2 != 0:
		secuen.append(arr[left])
	return ' '.join(secuen)
casos = int(sys.stdin.readline())
for i in range(casos):
	numCase = sys.stdin.readline()
	line = sys.stdin.readline().rstrip('\n').split(' ')
	resultado = polySecuence(line)
	sys.stdout.write(str(resultado) + '\n')


n = int(input(''))
for i in range(n):
	input('')
	temp = input('').split(' ')
	result = ''
	if len(temp) % 2 == 0:
		for j in range(len(temp)):
			if j == len(temp) // 2:
				break
			result += temp[j] + ' '
			result += temp[len(temp) - j - 1] + ' '
	else:
		for j in range(len(temp)):
			result += temp[j] + ' '
			if j == len(temp) // 2:
				break
			result += temp[len(temp) - j - 1] + ' '
	if len(temp) == 1:
		print(temp[0])
	elif len(temp) % 2 == 0:
		print(result[:-1])
	else:
		print(result)


t = int(input())
while t:
	n = int(input())
	li = list(map(int, input().split()))
	i = 0
	j = n - 1
	while i <= j:
		if i == j:
			print(li[i], end=' ')
			i += 1
			j -= 1
		else:
			print(li[i], end=' ')
			i += 1
			print(li[j], end=' ')
			j -= 1
	print()
	t -= 1


for x in range(int(input())):
	size = int(input())
	l = list(map(int, input().split()))
	fav_seq = [l[0]]
	if size % 2 != 0:
		for y in range(size // 2):
			fav_seq.append(l[-(y + 1)])
			fav_seq.append(l[y + 1])
	else:
		for y in range(size // 2):
			fav_seq.append(l[-(y + 1)])
			fav_seq.append(l[y + 1])
		fav_seq.pop()
	fav_seq = [str(i) for i in fav_seq]
	print(' '.join(fav_seq))


t = int(input())
for i in range(t):
	l = int(input())
	ina = input().split()
	t = []
	for ind in range(l):
		if ind % 2:
			t.append(ina[-((ind + 1) // 2)])
		else:
			t.append(ina[ind // 2])
	print(' '.join(t))


def GetInputOfTest():
	n = int(input())
	b = list(map(int, input().split()))
	return (n, b)

def SolOfTest(n, b):
	shift = 0
	a = list()
	for i in range(n):
		if i % 2 == 0:
			a.append(b[shift])
		else:
			a.append(b[-(shift + 1)])
			shift += 1
	return a.copy()
num_tests = int(input())
answers = []
for test_ind in range(num_tests):
	(n, b) = GetInputOfTest()
	a = SolOfTest(n, b)
	answers.append(a)
for a in answers:
	n = len(a)
	for i in range(n):
		if i < n - 1:
			print(a[i], end=' ')
		else:
			print(a[i])


def favourite_sequence(n, a):
	result = []
	i = 0
	j = n - 1
	while i <= j:
		if i < j:
			result.append(a[i])
			result.append(a[j])
			i += 1
			j -= 1
		else:
			result.append(a[i])
			i += 1
	return result
n_test_cases = int(input())
for i in range(n_test_cases):
	n = int(input())
	my_list = [int(f) for f in input().split()]
	res = favourite_sequence(n, my_list)
	print(' '.join([str(f) for f in res]))


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n):
		print(a[i // 2] if i % 2 == 0 else a[n - i // 2 - 1], end=' ')
	print()
t = int(input())
while t:
	solve()
	t -= 1


casos = int(input())
num = 0
while num < casos:
	i = 0
	j = -1
	nElementos = int(input())
	elementos = list(input().split(' '))
	listaNueva = []
	for x in range(nElementos):
		if x % 2 == 0:
			if x == nElementos - 1:
				print(elementos[i], end='\n')
			else:
				print(elementos[i], end=' ')
			i += 1
		else:
			if x == nElementos - 1:
				print(elementos[j], end='\n')
			else:
				print(elementos[j], end=' ')
			j -= 1
	num += 1


for _ in range(int(input())):
	a = int(input())
	b = [int(x) for x in input().split()]
	ans = []
	if a % 2 == 1:
		ans.append(b[0])
		for i in range(1, (a + 1) // 2):
			ans.append(b[-i])
			ans.append(b[i])
	else:
		for i in range(a // 2):
			ans.append(b[i])
			ans.append(b[-(i + 1)])
	print(*ans)


n = int(input())
for x in range(n):
	ans = ''
	x = input()
	l = ['0'] + input().split()
	t = int(len(l) / 2)
	if len(l) % 2 == 0:
		for x in range(1, t):
			ans += l[x] + ' ' + l[-x] + ' '
		ans += l[t]
		print(ans)
	elif len(l) % 2 != 0:
		for x in range(1, t + 1):
			ans += l[x] + ' ' + l[-x] + ' '
		print(ans.strip())


t = int(input())
for _ in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	s1 = []
	i = 0
	j = n - 1
	while i < n // 2 and j > n // 2:
		s1.append(s[i])
		s1.append(s[j])
		i += 1
		j -= 1
	if n % 2 != 0:
		s1.append(s[i])
	else:
		s1.append(s[i])
		s1.append(s[j])
	print(*s1)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = []
	mid = len(l) // 2
	k = len(l)
	for i in range(k):
		l1 += [l[i]]
		l1 += [l[k - 1]]
		k -= 1
		if k == mid:
			break
	if n % 2 == 0:
		for i in l1:
			print(i, end=' ')
		print()
	elif n % 2 != 0:
		for i in range(len(l1) - 1):
			print(l1[i], end=' ')
		print()


def readInt():
	return int(input())

def readLine():
	return [int(s) for s in input().split(' ')]

def readString():
	return input()

def ask(arr):
	p1 = 0
	p2 = len(arr) - 1
	alt = True
	returning = []
	while True:
		if p1 == p2:
			returning.append(arr[p1])
			return returning
		if alt:
			returning.append(arr[p1])
			p1 += 1
		else:
			returning.append(arr[p2])
			p2 -= 1
		alt = not alt
t = readInt()
for i in range(t):
	s = readInt()
	sts = readLine()
	result = ask(sts)
	print(' '.join([str(x) for x in result]))


def func(n):
	for _ in range(n):
		k = []
		int(input())
		m = list(input().split())
		if len(m) % 2 != 0:
			for _ in range(len(m) // 2):
				k.append(m[0])
				m.pop(0)
				k.append(m[-1])
				m.pop(-1)
			k.append(m[0])
			m.pop(0)
		elif len(m) % 2 == 0:
			for _ in range(len(m) // 2):
				k.append(m[0])
				m.pop(0)
				k.append(m[-1])
				m.pop(-1)
		k_list.append(k)
	for i in k_list:
		print(' '.join(i))
k_list = []
func(int(input()))


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = n // 2
	for i in range(m):
		print(a[i], a[n - 1 - i], sep=' ', end=' ')
	if n % 2:
		print(a[m])
	else:
		print()


for _ in range(int(input())):
	length = int(input())
	numbers = input().split()
	result = ''
	if length & 1:
		while len(numbers) != 1:
			result += numbers[0] + ' ' + numbers[-1] + ' '
			del numbers[0]
			del numbers[-1]
		print(result + numbers[0])
	else:
		while len(numbers) != 0:
			result += numbers[0] + ' ' + numbers[-1] + ' '
			del numbers[0]
			del numbers[-1]
		print(result)


def solve():
	n = int(input())
	arr = [int(v) for v in input().split()]
	l = 0
	r = n - 1
	ans = []
	while l <= r:
		ans.append(arr[l])
		if l < r:
			ans.append(arr[r])
		l += 1
		r -= 1
	print(' '.join((str(v) for v in ans)))
t = int(input())
for _ in range(t):
	solve()


def solve():
	t = int(input())
	for _ in range(t):
		n = int(input())
		m = input().split()
		ans = []
		l = 0
		r = n - 1
		while l < r:
			ans.append(m[l])
			ans.append(m[r])
			l += 1
			r -= 1
		if l == r:
			ans.append(m[l])
		print(' '.join(ans))
solve()


for _ in range(int(input())):
	n = int(input())
	answer = [0] * n
	seq = input().split()
	for i in range(n):
		if i % 2:
			answer[i] = seq.pop()
		else:
			answer[i] = seq.pop(0)
	print(*answer)


t = int(input())
for c in range(t):
	n = int(input())
	b = list(map(int, input().split(' ')))
	x = []
	k = 0
	m = n - 1
	i = 0
	s = ''
	while i < n:
		if i % 2 == 0:
			x.append(b[k])
			k = k + 1
		else:
			x.append(b[m])
			m = m - 1
		i = i + 1
	j = 0
	while j < n:
		s = s + str(x[j]) + ' '
		j = j + 1
	print(s)


t = int(input())
for o in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	j = n - 1
	while i < j:
		print(a[i], a[j], end=' ')
		i += 1
		j -= 1
	if n % 2 != 0:
		print(a[i], end=' ')
	print()


def solve(n, b):
	da = 1
	ans = []
	an = ''
	for i in range(n):
		ans.append(b[da])
		an += str(b[da]) + ' '
		b.pop(da)
		da = -da
	print(an)
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	b = list(input().split())
	b.insert(0, '0')
	a = solve(n, b)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n == 1:
		print(l[0])
	elif n == 2:
		print(l[0], l[1])
	else:
		a = 0
		h = n - 1
		while a < h:
			print(l[a], l[h], end=' ')
			a += 1
			h -= 1
		if n % 2 == 0:
			print()
		else:
			print(l[n // 2])


t = int(input())
for _ in range(t):
	n = int(input())
	lst = map(int, input().split())
	ans = [0] * n
	if n % 2 == 1:
		v = n - 1
	else:
		v = n - 2
	cur = 0
	y = 2
	for i in lst:
		if cur > v:
			if n % 2:
				cur = n - 2
			else:
				cur = n - 1
			y = -y
		ans[cur] = i
		cur += y
	print(' '.join((str(x) for x in ans)))


t = int(input())
for i in range(t):
	n = int(input())
	x = [str(item) for item in input().split(' ')]
	m = []
	for j in range(int(n / 2)):
		m.append(x[j])
		m.append(x[n - j - 1])
	if n % 2 != 0:
		m.append(x[int((n - 1) / 2)])
	print(f"{' '.join(m)}")


import math

def inp():
	return int(input())

def inlt():
	return list(map(str, input().split()))
x = inp()
for _ in range(x):
	lis = []
	n = inp()
	s = inlt()
	t = len(s)
	right = len(s) - 1
	for left in range(len(s) // 2):
		lis.append(s[left])
		lis.append(s[right])
		right -= 1
		if left > right:
			break
	if len(s) % 2 != 0:
		lis.append(s[len(s) // 2])
	result = ' '.join(lis)
	print(result)


a = int(input())
for i in range(a):
	s = int(input())
	z = list(map(int, input().split()))
	t = z[::-1]
	cnt = 0
	i = 0
	j = 0
	while cnt < len(z):
		if cnt % 2 == 0:
			print(z[i], end=' ')
			i += 1
		else:
			print(t[j], end=' ')
			j += 1
		cnt += 1
	print('')


for i in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	if n % 2 == 0:
		for i in range(n // 2 - 1):
			print(s[i], end=' ')
			print(s[n - i - 1], end=' ')
		print(s[n // 2 - 1], end=' ')
		print(s[n // 2])
	if n % 2 == 1:
		for i in range(n // 2):
			print(s[i], end=' ')
			print(s[n - i - 1], end=' ')
		print(s[n // 2])


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = l[::-1]
	k = []
	o = 0
	j = 0
	for i in range(n):
		if i % 2 == 0:
			k.append(l[o])
			o += 1
		else:
			k.append(l1[j])
			j += 1
	for i in k:
		print(i, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	c1 = 0
	c2 = -1
	l1 = []
	if n % 2 != 0:
		for j in range(len(l) // 2):
			l1.append(l[c1])
			l1.append(l[c2])
			c1 = c1 + 1
			c2 = c2 - 1
		l1.append(l[len(l) // 2])
		print(*l1)
	else:
		for j in range(len(l) // 2):
			l1.append(l[c1])
			l1.append(l[c2])
			c1 = c1 + 1
			c2 = c2 - 1
		print(*l1)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	for i in range(n // 2):
		ans.append(arr[i])
		ans.append(arr[n - i - 1])
	if n % 2 != 0:
		ans.append(arr[n // 2])
	print(*ans)


def polycarp():
	length = int(input())
	d = input().split()
	if length == len(d):
		dier = []
		x = 0
		y = -1
		for i in range(len(d) // 2):
			dier.append(d[x])
			dier.append(d[y])
			x += 1
			y -= 1
		if len(d) % 2 > 0:
			dier.append(d[len(d) // 2])
		print(*dier)
t = int(input())
for i in range(t):
	polycarp()


t = int(input())
while t != 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	i = 0
	j = n - 1
	ans = []
	f = 0
	while i <= j:
		if f == 0:
			ans.append(list1[i])
			f = 1
			i += 1
		else:
			ans.append(list1[j])
			f = 0
			j -= 1
	print(*ans)
	t -= 1


def solve():
	n = int(input())
	arr = [int(x) for x in input().split()]
	y = [0] * n
	x = 0
	(l, r) = (0, n - 1)
	t = -1
	while l <= r:
		if t == -1:
			y[x] = arr[l]
			l += 1
		else:
			y[x] = arr[r]
			r -= 1
		t *= -1
		x += 1
	for j in y:
		print(j, end=' ')
	print()
t = int(input())
for i in range(t):
	solve()


def ordenar(lista, n):
	c = 1
	i = 0
	j = n - 1
	policarp = []
	if n == 1:
		policarp.append(lista[0])
		return policarp
	while len(policarp) < n:
		if c == 3:
			c = 1
		if c % 2 == 1:
			policarp.append(lista[i])
			i += 1
			c += 1
		elif c % 2 == 0:
			policarp.append(lista[j])
			j -= 1
			c += 1
	return policarp

def main():
	t = int(input())
	c = 0
	string = ''
	resultados = []
	while c < t:
		c += 1
		n = int(input())
		lista = input()
		lista = lista.split()
		result = ordenar(lista, n)
		for i in result:
			string += str(i) + ' '
		string += '\n'
	string = string[0:-1]
	print(string)
main()


def order(a, b):
	front = 0
	back = a - 1
	out = ''
	while front <= back:
		if front == back:
			out += str(b[front]) + ' '
			break
		out += str(b[front]) + ' '
		out += str(b[back]) + ' '
		front += 1
		back -= 1
	return out[0:-1]
	return evens
n = int(input())
for i in range(n):
	size = int(input())
	line = [int(x) for x in input().split(' ')]
	print(order(size, line))


for _ in range(int(input())):
	n = int(input())
	b = list(map(int, input().split()))
	a = []
	l = 0
	r = n - 1
	for i in range(n):
		if i % 2 == 0:
			a.append(b[l])
			l += 1
		else:
			a.append(b[r])
			r -= 1
	print(*a)


import math
from collections import defaultdict
from sys import stdin
input = stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	l = []
	j = n - 1
	s = 0
	for i in range(n):
		if i % 2 == 0:
			l.append(arr[s])
			s += 1
		else:
			l.append(arr[j])
			j -= 1
	print(*l)


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	flag = True
	while arr:
		if flag:
			print(arr.pop(0), end=' ')
			flag = False
		else:
			print(arr.pop(-1), end=' ')
			flag = True
	print()

def main():
	for _ in range(int(input())):
		solve()
main()


def main():
	n = int(input())
	b = list(map(int, input().split(' ')))
	i = 0
	j = 0
	temp = 0
	check = 0
	nb = []
	while i < n:
		if i % 2:
			print(str(b[j]), end=' ')
			j = temp
		else:
			print(str(b[j]), end=' ')
			j = n - 1 - temp
			temp += 1
		i += 1
	print('')
for _ in range(int(input())):
	main()


for _ in range(int(input())):
	n = int(input())
	b = list(input().split())
	(s, i) = ('', 0)
	while b:
		s += ' ' + b.pop(i)
		i = 0 if i else -1
	print(s[1:])


for i in range(int(input())):
	x = int(input())
	l = list(map(int, input().split()))
	m = []
	i = 0
	while l:
		if i % 2 == 0:
			m.append(l.pop(0))
		else:
			m.append(l.pop())
		i += 1
	print(*m)


t = int(input())
for k in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	j = n - 1
	ans = []
	num = 0
	while i <= j:
		print(l[i], end=' ')
		if i != j:
			print(l[j], end=' ')
		j -= 1
		i += 1
	print()


for _ in range(int(input())):
	size = int(input())
	arr = [int(i) for i in input().split()]
	assert size == len(arr)
	og = []
	for i in range(size):
		if i % 2 == 0:
			og.append(arr[i // 2])
		else:
			og.append(arr[size - i // 2 - 1])
	print(' '.join((str(i) for i in og)))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(int(n // 2)):
		print(a[i], a[n - i - 1], end=' ')
	if n % 2 != 0:
		print(a[int(n // 2)], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	b = [int(x) for x in input().split()]
	a = []
	for i in range(n):
		if len(b) == 0:
			break
		a.append(b[0])
		del b[0]
		if len(b) == 0:
			break
		else:
			a.append(b[-1])
			del b[-1]
	print(' '.join((repr(y) for y in a)))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	new = arr[:]
	for i in range(len(arr)):
		if i % 2 == 0:
			new[i] = arr[i // 2]
		if i % 2 != 0:
			new[i] = arr[-(i // 2) - 1]
	print(' '.join(map(str, new)))


t = int(input())
for _ in range(t):
	a = []
	n = int(input())
	arr = list(map(int, input().split()))
	for i in range(n // 2):
		a.append(arr[i])
		a.append(arr[-(i + 1)])
	if n % 2 == 1:
		a.append(arr[n // 2])
	print(*a)


from collections import deque
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = deque(list(map(int, input().split())))
	ans = []
	while len(a) > 1:
		ans.append(a.popleft())
		ans.append(a.pop())
	if a:
		ans.append(a.pop())
	print(*ans)


t = int(input())
while t:
	n = int(input())
	arr = [int(x) for x in input().split()]
	res = []
	i = 0
	j = n - 1
	while i < j:
		res.append(arr[i])
		res.append(arr[j])
		i += 1
		j -= 1
	if n % 2 != 0:
		res.append(arr[n // 2])
	print(*res)
	t -= 1


import sys

def favSequence(sequence):
	ans = []
	(left, right) = (0, len(sequence) - 1)
	leftTurn = True
	while left <= right:
		if leftTurn:
			ans.append(sequence[left])
			left += 1
		else:
			ans.append(sequence[right])
			right -= 1
		leftTurn = not leftTurn
	return ans
casos = int(sys.stdin.readline())
for i in range(casos):
	valores = sys.stdin.readline()
	line = sys.stdin.readline().rstrip('\n').split(' ')
	ans = favSequence(line)
	sys.stdout.write(' '.join(ans) + '\n')


t1 = int(input())
for i in range(t1):
	n = int(input())
	p = n // 2
	t = ''
	a = list(map(int, input().split()))
	b = []
	c = []
	for j in range(p):
		b.append(a[j])
	for j in range(p, n):
		c.append(a[j])
	c.reverse()
	if n % 2 == 1:
		p += 1
		for j in range(p):
			if j + 1 < p:
				t += str(b[j]) + ' '
			t += str(c[j]) + ' '
	else:
		for j in range(p):
			if j + 1 < p + 1:
				t += str(b[j]) + ' '
			t += str(c[j]) + ' '
	print(t[:-1])


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	x = 0
	y = -1
	z = []
	for j in range(int(n / 2)):
		z.append(a[x])
		z.append(a[y])
		y -= 1
		x += 1
	if n % 2 != 0:
		z.append(a[int(n / 2)])
	z = str(z).replace(',', '').replace('[', '').replace(']', '')
	print(z)


test = input('')
i = 0
number = []
while i < 2 * int(test):
	x = input()
	i += 1
	number.append(x)
i = 0
for i in range(int(test)):
	length = int(number[2 * i])
	seq = str(number[2 * i + 1]).split(' ')
	a = []
	ans = ' '
	r = 0
	while r < length / 2:
		a.append(str(seq[r]))
		a.append(str(seq[length - r - 1]))
		r += 1
	if length % 2 != 0:
		a = a[:-1]
		print(ans.join(a))
	else:
		print(ans.join(a))
	i += 1


t = int(input())
for _ in range(t):
	n = int(input())
	old = list(map(int, input().split()))
	new = []
	i = 0
	for i in range(n):
		if i % 2 == 0:
			new.append(old.pop(0))
		else:
			new.append(old.pop())
	print(' '.join(map(str, new)))


T = int(input())
for t in range(T):
	n = int(input())
	z = input()
	a = z.split()
	a = [int(i) for i in a]
	A = [0 for _ in range(n)]
	k = 0
	(i, j) = (0, n - 1)
	while i <= j:
		if i == j:
			A[k] = a[i]
		A[k] = a[i]
		k += 1
		i += 1
		if k < n:
			A[k] = a[j]
			k += 1
			j -= 1
	for i in range(n - 1):
		print(A[i], end=' ')
	print(A[n - 1])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mid = n // 2
	x = 0
	while True:
		if x == mid:
			if n % 2 != 0:
				print(a[x])
			else:
				print()
			break
		print(a[x], a[n - x - 1], end=' ')
		x += 1


ip = int(input())
for i in range(ip):
	j = int(input())
	k = [int(i) for i in input().split()]
	m = []
	n = []
	s = ''
	if j % 2 == 1:
		m = k[0:j // 2 + 1]
		n = k[j // 2 + 1:]
	else:
		m = k[0:j // 2]
		n = k[j // 2:]
	for i in range(j):
		if i % 2 == 0:
			s += str(m[0]) + ' '
			del m[0]
		else:
			s += str(n[-1]) + ' '
			del n[-1]
	print(s)


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	m = [0] * n
	a = 0
	b = n - 1
	for i in range(n):
		if i & 1:
			m[i] = l[b]
			b -= 1
		else:
			m[i] = l[a]
			a += 1
	print(*m)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	f = 0
	e = len(l) - 1
	res = []
	while f <= e:
		res.append(l[f])
		res.append(l[e])
		f += 1
		e -= 1
	if len(l) % 2 != 0:
		print(*res[:-1])
	else:
		print(*res)


import math
n = int(input())
for i in range(2 * n):
	m = input()
	p = []
	if i % 2 == 1:
		a = m.split()
		q = math.ceil(len(a) / 2)
		x = a[:q]
		y = list(a[len(a):q - 1:-1])
		for j in range(len(a)):
			if j % 2 == 0:
				p.append(x.pop(0))
			elif j % 2 == 1:
				p.append(y.pop(0))
		print(' '.join(p))


from math import ceil
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	t1 = []
	t2 = []
	for x in range(ceil(n / 2)):
		t1.append(l[x])
		t1.append(l[n - x - 1])
	if n % 2 != 0:
		t1.pop()
	for x in t1:
		print(x, end=' ')
	print()


import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = [0 for i in range(n)]
	for i in range(math.ceil(n / 2)):
		ans[2 * i] = l[i]
	if n % 2:
		x = n - 2
	else:
		x = n - 1
	for i in range(math.ceil(n / 2), n):
		ans[x] = l[i]
		x -= 2
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	(*a,) = map(int, input().split())
	b = []
	for i in range(len(a) // 2):
		b.append(a[i])
		b.append(a[-(i + 1)])
	if n % 2 == 1:
		b.append(a[n // 2])
	print(*b)


n = int(input())
for i in range(n):
	l = int(input())
	arr = input().split()
	s = []
	for x in range(l):
		if len(arr) == 0:
			break
		s.append(arr[0])
		arr.pop(0)
		if len(arr) == 0:
			break
		s.append(arr[-1])
		arr.pop(-1)
	print(' '.join(s))


t = int(input())
for i in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	a = []
	c = 0
	d = n - 1
	if n < 3:
		print(*b)
	else:
		for i in range(n // 2):
			a.append(b[c])
			c += 1
			a.append(b[d])
			d -= 1
		if n % 2 == 1:
			a.append(b[n // 2 + 1 - 1])
		print(*a)


n = int(input())
for i in range(n):
	a = int(input())
	b = input().split(' ')
	result = []
	central = a // 2
	for j in range(central):
		result.append(b[j])
		result.append(b[-j - 1])
	if a % 2 == 1:
		result.append(b[central])
	print(' '.join(result))


t = int(input())
list = []
for i in range(t):
	n = int(input())
	s = input()
	s = s.split(' ')
	i = 0
	j = -1
	n_s = ''
	if n % 2 == 0:
		while i + 1 <= n // 2:
			n_s = n_s + s[i] + ' ' + s[j] + ' '
			i = i + 1
			j = j - 1
		n_s = n_s[0:-1]
	else:
		while i + 1 <= n // 2:
			n_s = n_s + s[i] + ' ' + s[j] + ' '
			i = i + 1
			j = j - 1
		n_s = n_s + s[i]
	list.append(n_s)
for item in list:
	print(item)


t = int(input())
for turn in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	for i in range(n):
		try:
			q = a.pop(0)
			b.append(q)
		except:
			break
		try:
			q = a.pop(-1)
			b.append(q)
		except:
			break
	print(' '.join(map(str, b)))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	b = list(map(int, input().split()))
	a = []
	for i in range(n):
		if i % 2 == 0:
			a.append(b[i // 2])
		else:
			a.append(b[-((i + 1) // 2)])
	print(*a)


t = int(input())
for i in range(t):
	n = int(input())
	w = list(map(int, input().split()))
	w1 = []
	for j in range(n // 2):
		w1.append(w[j])
		w1.append(w[-j - 1])
	if n % 2 == 1:
		w1.append(w[n // 2])
	print(*w1)


import sys

def seqn(arr):
	ans = []
	l = 0
	r = len(arr) - 1
	turn = 0
	while l <= r:
		if turn == 0:
			ans.append(arr[l])
			l += 1
			turn = 1
		else:
			ans.append(arr[r])
			r -= 1
			turn = 0
	return ans
cases = int(sys.stdin.readline())
for i in range(cases):
	numCase = sys.stdin.readline()
	line = map(int, sys.stdin.readline().split(' '))
	ans = seqn(list(line))
	print(' '.join(map(str, ans)))


for _ in range(int(input())):
	l = int(input())
	a = list(map(int, input().split()))
	for i in range(1, len(a), 2):
		x = a.pop(-1)
		a.insert(i, x)
	print(*a)


T = int(input())
while T:
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	first = 0
	last = n - 1
	for i in range(n):
		if i % 2 == 0:
			print(a[first], end=' ')
			first += 1
		else:
			print(a[last], end=' ')
			last -= 1
	T -= 1


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	b = [0 for i in range(n)]
	j = 0
	T = True
	for i in range(n):
		b[j] = a[i]
		if T:
			j = j + 2
		else:
			j = j - 2
		if j >= n:
			T = False
			if n % 2 == 0:
				j = n - 1
			else:
				j = n - 2
	print(' '.join(list(map(str, b))))
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	x = list(map(int, input().split()))
	if n % 2 == 0:
		y = x[0:n // 2]
		z = x[n // 2:]
		z = z[::-1]
		k = 0
		for j in range(len(z)):
			k = k + 1
			y.insert(j + k, z[j])
		print(*y)
	else:
		y = x[0:n // 2 + 1]
		z = x[n // 2 + 1:]
		z = z[::-1]
		k = 0
		for j in range(len(z)):
			k = k + 1
			y.insert(j + k, z[j])
		print(*y)


Test = int(input())
for T in range(Test):
	N = int(input())
	A = list(map(int, input().split()))
	Cad = ''
	Izq = 0
	Dere = N - 1
	Fin = N // 2
	while Izq < Fin:
		Cad = Cad + str(A[Izq]) + ' '
		Cad = Cad + str(A[Dere]) + ' '
		Izq = Izq + 1
		Dere = Dere - 1
	if N % 2 == 0:
		print(Cad[:len(Cad) - 1])
	else:
		Cad = Cad + str(A[Izq])
		print(Cad)


def w(n, line):
	first = line[:n // 2 + 1][::-1]
	second = line[n // 2:]
	total = []
	for i in range(n):
		if i % 2 == 0:
			total.append(first.pop())
		else:
			total.append(second.pop())
	ans = ' '.join(map(str, total))
	return ans
t = int(input())
for _ in range(t):
	n = int(input())
	line = list(map(int, input().split()))
	print(w(n, line))


t = int(input())
for k in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	b = list()
	for i in range(n // 2):
		b.append(a[i])
		b.append(a[n - i - 1])
	if n % 2 != 0:
		b.append(a[n // 2])
	print(*b)


for i in range(int(input())):
	n = int(input())
	s = list(map(str, input().split()))
	i = 0
	j = -1
	res = ''
	while True:
		res += s[i] + ' '
		if i == len(s) // 2:
			break
		res += s[j] + ' '
		if len(s) % 2 == 0:
			if abs(j) == len(s) // 2:
				break
		if len(s) % 2 != 0:
			if abs(j) == len(s) // 2 + 1:
				break
		i += 1
		j -= 1
	print(res)


for _ in range(int(input())):
	k = int(input())
	a = list(map(int, input().split()))[:k]
	l = []
	for i in range(len(a) // 2 + 1):
		l.append(a[i])
		l.append(a[~i])
	print(*l[:len(a)])


from collections import deque

def solution(n, blist):
	deq = deque(blist)
	ans = []
	for i in range(len(blist)):
		if i % 2 == 0:
			ans.append(deq.popleft())
		else:
			ans.append(deq.pop())
	return ans
t = int(input())
for tt in range(t):
	n = int(input())
	blist = list(map(int, input().split()))
	for num in solution(n, blist):
		print(num, end=' ')
	print()


for _ in range(int(input())):
	input()
	a = input().split()
	l = []
	for i in range(len(a) // 2):
		l.extend([a[i], a[len(a) - 1 - i]])
	if len(a) % 2 != 0:
		l.append(a[int(len(a) / 2)])
	print(' '.join(l))


for _ in range(int(input())):
	n = int(input())
	arr = list(input().split())
	left = 0
	right = n - 1
	ans = []
	while left <= right:
		if left == right:
			ans.append(arr[left])
			break
		else:
			ans.append(arr[left])
			ans.append(arr[right])
			left += 1
			right -= 1
	print(' '.join(ans))


from math import *
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

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

class Solution:

	def __init__(self):
		self.ans = 0

	def solve(self, a, n):
		helper = [0] * n
		(left, right) = (0, n - 1)
		(i, j) = (0, 1)
		while left <= right:
			if left == right:
				helper[i] = a[left]
			else:
				helper[i] = a[left]
				helper[j] = a[right]
			left += 1
			right -= 1
			i += 2
			j += 2
		return helper
sol = Solution()
t = inp()
ans = []
while t:
	n = inp()
	a = inlt()
	ans.append(sol.solve(a, n))
	t -= 1
for i in range(len(ans)):
	print(*ans[i], end='\n')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	for i in range(n // 2):
		b.append(a[i])
		b.append(a[-(i + 1)])
	if not n % 2 == 0:
		b.append(a[n // 2])
	print(' '.join((str(x) for x in b)))


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_list_string():
	return list(map(str, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def get_int():
	return int(sys.stdin.readline().strip())

def get_print_int(x):
	sys.stdout.write(str(x) + '\n')

def get_print(x):
	sys.stdout.write(x + '\n')
from sys import maxsize

def solve():
	for _ in range(get_int()):
		n = get_int()
		arr = get_list()
		temp = [0] * n
		s = 0
		for i in range(0, n, 2):
			temp[i] = arr[s]
			s += 1
		s = n - 1
		for i in range(1, n, 2):
			temp[i] = arr[s]
			s -= 1
		get_print(' '.join(map(str, temp)))
solve()


for _ in range(int(input())):
	n = int(input())
	s = input().split()
	mid = n // 2
	if n % 2 != 0:
		mid += 1
	s1 = s[:mid]
	s2 = s[mid:][::-1]
	ans = []
	for i in range(0, len(s2)):
		ans.append(s1[i])
		ans.append(s2[i])
	if n % 2 != 0:
		ans.append(s1[-1])
	print(' '.join(ans))


def answer(array):
	lt = len(array)
	l = len(array) // 2
	temp = []
	for i in range(l):
		temp.append(array[i])
		temp.append(array[len(array) - 1 - i])
	if lt % 2 != 0:
		temp.append(array[l])
	return temp
t = int(input())
for i in range(t):
	n = int(input())
	array = list(map(int, input().split()))
	ans = answer(array)
	for i in range(len(ans)):
		print(ans[i], end=' ')
	print(end=' \n')


def ans(A):
	i = 0
	j = len(A) - 1
	ret = []
	for x in range(len(A)):
		if x % 2 == 0:
			ret += [A[i]]
			i += 1
		else:
			ret += [A[j]]
			j -= 1
	return ret
for _ in range(int(input())):
	input()
	A = list(map(int, input().split()))
	print(*ans(A))


test_cases = int(input())
for i in range(test_cases):
	size = int(input())
	arr = list(map(int, input().split()))
	ans = []
	for i in range(size // 2):
		ans.append(str(arr[i]))
		ans.append(str(arr[size - i - 1]))
	if size % 2 != 0:
		ans = ans + [str(arr[size // 2])]
	print(' '.join(ans))


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	n = read_int()
	a = list(read_ints())
	l = 0
	r = n - 1
	ans = []
	for i in range(n):
		if i % 2 == 0:
			ans.append(a[l])
			l += 1
		else:
			ans.append(a[r])
			r -= 1
	print(' '.join(map(str, ans)))


import math
for i in range(int(input())):
	n = int(input())
	q = []
	l = list(map(int, input().split()))
	p = math.ceil(n / 2)
	for i in range(p):
		q.append(l[i])
		if i != len(l) - 1 - i:
			q.append(l[len(l) - i - 1])
	print(*q)


n = int(input())
for i in range(n):
	t = int(input())
	s = input().split()
	q = 0
	w = t - 1
	if abs(q - w) == 1:
		print(s[q], s[w])
	elif len(s) == 1:
		print(*s)
	else:
		while q != w:
			print(s[q], s[w], end=' ')
			q += 1
			w -= 1
			if q == w:
				print(s[q])
				break
			elif abs(q - w) == 1:
				print(s[q], s[w])
				break


for _ in range(int(input())):
	n = int(input())
	b = list(map(int, input().split()))
	i = 0
	j = n - 1
	a = []
	while i <= j:
		a.append(b[i])
		if i != j:
			a.append(b[j])
		i += 1
		j -= 1
	print(*a)


t = int(input())
for k in range(t):
	n = int(input())
	ar = input().split()
	(l, r) = (0, n - 1)
	ans = []
	while l <= r:
		if l != r:
			ans.append(ar[l])
			ans.append(ar[r])
		else:
			ans.append(ar[l])
		l += 1
		r -= 1
	print(' '.join(ans))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = [0] * n
	b = 0
	e = n - 1
	i = 0
	while b <= e:
		if i % 2:
			a[i] = l[e]
			e -= 1
		else:
			a[i] = l[b]
			b += 1
		i += 1
	print(*a, sep=' ')


from sys import stdin
from sys import stdout
from math import *
input = stdin.readline
for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	x = 0
	y = n - 1
	ans = []
	while x < y:
		ans.append(ar[x])
		ans.append(ar[y])
		x += 1
		y -= 1
	if x == y:
		ans.append(ar[x])
	print(*ans)


t = int(input())
for x in range(t):
	n = int(input())
	b = [int(x) for x in input().split()]
	r = [0 for x in range(n)]
	i = 0
	j = 0
	while i < n:
		r[i] = b[j]
		if i + 1 != n:
			r[i + 1] = b[n - (j + 1)]
		i += 2
		j += 1
	print(' '.join(map(str, r)))


for rrr in range(int(input())):
	n = int(input())
	abc = list(map(int, input().split()))
	bbb = []
	if n == 1:
		print(abc[0], end=' ')
	else:
		for i in range(n // 2):
			bbb.append(abc[i])
			bbb.append(abc[n - i - 1])
		if n % 2 != 0:
			bbb.append(abc[n // 2])
		for i in bbb:
			print(i, end=' ')
	print()


import sys
input = sys.stdin.readline
output = sys.stdout.write

def main():
	tests = int(input().rstrip())
	for i in range(tests):
		length_ = int(input().rstrip())
		list_ = list(map(int, input().rstrip().split()))
		l = 0
		r = length_ - 1
		mid_ = length_ // 2
		if length_ % 2 == 0:
			state = True
		else:
			state = False
		seq = []
		for j in range(mid_):
			seq.append(list_[l + j])
			seq.append(list_[r - j])
		if state is False:
			seq.append(list_[mid_])
		for num in seq:
			output(str(num) + ' ')
		output('\n')
main()


def polycarp(Lst):
	rst = []
	r = True
	for i in range(len(Lst)):
		if r == True:
			rst.append(Lst[0])
			del Lst[0]
			r = False
		else:
			rst.append(Lst[len(Lst) - 1])
			del Lst[len(Lst) - 1]
			r = True
	return rst
t = int(input())
for i in range(t):
	n = int(input())
	Lista = input().split(' ')
	lst = []
	for i in Lista:
		lst.append(int(i))
	resultado = polycarp(lst)
	for i in resultado:
		(print(i, end=' '),)
	print('')


t = eval(input())
for i in range(t):
	n = eval(input())
	input_list = input().split(' ')
	output_list = []
	p = 0
	q = n - 1
	for j in range(1, n + 1):
		if j % 2 == 1:
			output_list.append(input_list[p])
			p += 1
		else:
			output_list.append(input_list[q])
			q -= 1
	print(' '.join(output_list))


from math import ceil

def readGenerator():
	while True:
		tokens = input().split(' ')
		for t in tokens:
			yield t
reader = readGenerator()

def readWord():
	return next(reader)

def readInt():
	return int(next(reader))

def readFloat():
	return float(next(reader))

def readLine():
	return input()

def fact(n):
	return n * fact(n - 1) if n > 1 else n

def solve(n, b):
	a = []
	for k in range(n // 2):
		a.append(str(b[k]))
		a.append(str(b[n - k - 1]))
	if n % 2 != 0:
		a.append(str(b[n // 2]))
	return ' '.join(a)
t = readInt()
for _ in range(t):
	n = readInt()
	b = [readInt() for _ in range(n)]
	print(solve(n, b))


import math
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = 0
	b = n - 1
	ans = []
	while a < b:
		ans.append(l[a])
		ans.append(l[b])
		b = b - 1
		a = a + 1
	if a == b:
		ans.append(l[b])
	print(*ans)


x = int(input())
for i in range(x):
	m = []
	y = int(input())
	l = list(map(int, input().split()))
	a = y // 2
	for j in range(a):
		m.append(l[j])
		l.reverse()
		m.append(l[j])
		l.reverse()
	if y % 2 != 0:
		m.append(l[a])
		print(*m)
	else:
		print(*m)


test = int(input())
for t in range(test):
	n = int(input())
	a = list(map(int, input().split()))
	x = []
	if n % 2 == 1:
		for i in range(n // 2):
			x.append(a[i])
			x.append(a[n - 1 - i])
		x.append(a[n // 2])
		for i in range(len(x)):
			if i != len(x) - 1:
				print(x[i], end=' ')
			else:
				print(x[i])
	else:
		for i in range(n // 2):
			x.append(a[i])
			x.append(a[n - 1 - i])
		for i in range(len(x)):
			if i != len(x) - 1:
				print(x[i], end=' ')
			else:
				print(x[i])


for _ in range(int(input())):
	n = int(input())
	ar = [0 for i in range(n)]
	se = list(map(int, input().split()))
	if n % 2 == 0:
		li = n // 2
		l2 = n // 2
	else:
		li = n // 2 + 1
		l2 = n // 2
	od = []
	ev = []
	for i in range(n):
		if i % 2 == 0:
			ev.append(i)
		else:
			od.append(i)
	for i in range(li):
		ar[ev[i]] = se[i]
	se = se[::-1]
	for i in range(l2):
		ar[od[i]] = se[i]
	print(*ar)


for _ in range(int(input())):
	n = int(input())
	b = list(map(int, input().split()))
	b1 = b[::-1]
	res = []
	if n % 2 != 0:
		for i in range(n // 2 + 1):
			res.append(b[i])
			res.append(b1[i])
		print(*res[0:n])
	else:
		for j in range(n // 2):
			res.append(b[j])
			res.append(b1[j])
		print(*res)


def solve(seq_len, seq):
	(i, j, counter) = (0, seq_len - 1, 0)
	new_seq = []
	while i <= j:
		if counter % 2 == 0:
			new_seq.append(str(seq[i]))
			i += 1
			counter += 1
		else:
			new_seq.append(str(seq[j]))
			j -= 1
			counter += 1
	return ' '.join(new_seq)

def read_input():
	cases = int(input())
	for t in range(cases):
		seq_len = int(input())
		seq = [int(n) for n in input().split()]
		print(solve(seq_len, seq))
read_input()


testcases = int(input())
while testcases > 0:
	n = int(input())
	myArray = list(map(int, input().split()))
	if len(myArray) == 1 or len(myArray) == 2:
		for i in range(len(myArray)):
			print(myArray[i], end=' ')
	else:
		i = 0
		j = len(myArray) - 1
		myNewArray = []
		while j >= i:
			if j > i:
				myNewArray.append(myArray[i])
				myNewArray.append(myArray[j])
			else:
				myNewArray.append(myArray[i])
			i += 1
			j -= 1
		for i in range(len(myNewArray)):
			print(myNewArray[i], end=' ')
	testcases -= 1


t = int(input())
for _ in range(0, t):
	m = int(input())
	i = 0
	s = list(map(int, input().strip().split(' ')))
	j = len(s) - 1
	a = []
	if len(s) == 1:
		a.append(*s)
	while i < j:
		a.append(s[i])
		a.append(s[j])
		i += 1
		j -= 1
		if i == j:
			a.append(s[i])
	print(*a)


for i in range(int(input())):
	seq_len = int(input())
	seq = input().split()
	restored_seq = [seq[i] + ' ' + seq[-i - 1] for i in range(seq_len // 2)]
	if seq_len % 2 == 1:
		restored_seq.append(seq[seq_len // 2])
	print(' '.join(restored_seq))


n = int(input())
a = []
for i in range(n):
	k = []
	m = int(input())
	p = [int(x) for x in input().split()]
	if m % 2 == 0:
		for i in range(1, int(m / 2) + 1):
			k.append(p[i - 1])
			k.append(p[-i])
	else:
		for i in range(1, (m + 2) // 2):
			k.append(p[i - 1])
			k.append(p[-i])
		k.append(p[len(p) // 2])
	a.append(k)
for i in a:
	print(*i)


from itertools import islice, cycle, compress, tee, zip_longest
from sys import stdin

def solve(x):
	n = len(x)
	y = tee(map(lambda a: a.strip(), x), 2)
	return ' '.join(list(map(lambda a: a[0] + ' ' + a[1], zip_longest(islice(y[0], n // 2 + n % 2), reversed(list(islice(y[1], n // 2 + n % 2, None))), fillvalue=''))))
v = list(map(lambda x: x.split(' '), compress(islice(stdin.readlines(), 1, None), cycle([0, 1]))))
print('\n'.join(list(map(solve, v))))


for _ in range(int(input())):
	n = int(input())
	ans = []
	ini = list(map(int, input().split()))
	for i in range(n):
		if i % 2 == 0:
			ans.append(ini.pop(0))
		else:
			ans.append(ini.pop())
	print(*ans)


n_testcase = int(input())
for i in range(n_testcase):
	n = int(input())
	s = input().split()
	lst = []
	for j in range(n // 2):
		lst.append(s[j])
		lst.append(s[n - 1 - j])
	if n == 1:
		lst.append(s[0])
	elif n % 2 != 0:
		lst.append(s[j + 1])
	print(' '.join(lst))


t = int(input())
while t > 0:
	a = int(input())
	b = list(map(int, input().split()))
	Sol = []
	while a > 1:
		Sol.append(b.pop(0))
		Sol.append(b.pop())
		a -= 2
	if len(b) > 0:
		Sol.append(b.pop())
	print(*Sol)
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	if len(a) == 1:
		print(a[0])
	else:
		l1 = a[:n - n // 2]
		l2 = a[-(n // 2):]
		l2 = l2[::-1]
		x = ''
		for j in range(len(l1)):
			x += l1[j] + ' '
			try:
				x += l2[j] + ' '
			except:
				pass
		print(x)


vezes = int(input())
for i in range(vezes):
	original = ''
	quant = int(input())
	lista = list(map(int, input().split()))
	l = 0
	r = quant - 1
	while l < r:
		original += str(lista[l]) + ' '
		original += str(lista[r]) + ' '
		l += 1
		r -= 1
	if quant % 2 == 1:
		original += str(lista[int(quant / 2)]) + ' '
	original = str.rstrip(original)
	print(original)


for testcases in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	left = i = 0
	right = n - 1
	revlist = []
	while i < n:
		if i % 2 == 0:
			revlist.append(a[left])
			left += 1
		else:
			revlist.append(a[right])
			right -= 1
		i += 1
	for i in revlist:
		print(i, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	array = input().split()
	answer = [None for _ in range(n)]
	l = 0
	r = n - 1
	for i in range(n):
		if not i % 2:
			answer[i] = array[l]
			l += 1
		else:
			answer[i] = array[r]
			r -= 1
	print(' '.join(answer))


import sys
input = sys.stdin.readline
from collections import deque
t = int(input())
for tests in range(t):
	n = int(input())
	B = deque(map(int, input().split()))
	A = []
	f = 1
	while B:
		if f == 1:
			x = B.popleft()
			A.append(x)
		else:
			x = B.pop()
			A.append(x)
		f = 1 - f
	print(*A)


import math
from time import time
from collections import Counter, deque, defaultdict

def main():
	n = int(input())
	A = list(map(int, input().split()))
	B = []
	a = 0
	b = n - 1
	move = 0
	while a <= b:
		if move == 0:
			B.append(A[a])
			a += 1
			move = 1
		else:
			B.append(A[b])
			b -= 1
			move = 0
	print(' '.join(map(str, B)))
for i in range(int(input())):
	main()


from math import ceil

def solution(list):
	originalList = []
	i = 0
	j = len(list) - 1
	string = ''
	for x in range(0, ceil(len(list) / 2)):
		if j != i:
			originalList.append(list[i])
			originalList.append(list[j])
			i += 1
			j -= 1
		else:
			originalList.append(list[j])
	for i in originalList:
		string += i + ' '
	print(string)
tests = int(input())
for x in range(tests):
	n = int(input())
	cards = list(input().split())
	solution(cards)


t = int(input())
for i in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	c = [0] * n
	p = 0
	q = n - 1
	action = 0
	for g in range(n):
		if action == 0:
			c[g] = b[p]
			p += 1
			action = 1
		else:
			c[g] = b[q]
			q -= 1
			action = 0
	print(*c)


for tt in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	left = 0
	right = n - 1
	p = 0
	while left != right:
		if p == 0:
			print(a[left], end=' ')
			p = 1
			left += 1
		else:
			print(a[right], end=' ')
			p = 0
			right -= 1
	print(a[left], end=' ')
	print()


ans = []
for _ in range(int(input())):
	n = int(input())
	seq = [*map(int, input().split())]
	tmp = [0] * n
	for i in range(n):
		if i % 2:
			tmp[i] = seq[-(i // 2) - 1]
		else:
			tmp[i] = seq[i // 2]
	ans += [tmp]
for a in ans:
	print(*a)


for i in range(int(input())):
	n = int(input())
	a = [int(a) for a in input().split()]
	i = 0
	j = 0
	k = -1
	l = []
	while i <= n // 2:
		l.append(a[j])
		l.append(a[k])
		i += 1
		j += 1
		k -= 1
	if n % 2 == 1:
		print(*l[:-1])
	else:
		print(*l[:-2])


import math
t = int(input())
results = []

def calc(A):
	l = math.ceil(len(A))
	i = 0
	j = len(A) - 1
	result = []
	start = True
	while l:
		if start:
			result.append(A[i])
			i += 1
		else:
			result.append(A[j])
			j -= 1
		l -= 1
		start = not start
	r = ''.join((str(e) + ' ' for e in result))
	return r
for i in range(t):
	n = int(input())
	A = tuple(map(int, input().split()))
	print(calc(A) + ' ')


def func(arr, n):
	i = 0
	j = n - 1
	fav_seq = []
	t = 1
	while i <= j:
		if t % 2 != 0:
			fav_seq.append(arr[i])
			i += 1
		else:
			fav_seq.append(arr[j])
			j -= 1
		t += 1
	return fav_seq
for i in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	fav_seq = func(A, n)
	print(*fav_seq)


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	res = []
	for x in range(0, n // 2):
		res.append(str(a[x]))
		res.append(str(a[n - x - 1]))
	if n % 2 != 0:
		res.append(str(a[n // 2]))
	print(' '.join(res))
	t = t - 1


ans = []
for x in range(int(input())):
	elem = []
	length = int(input())
	nums = list(map(int, input().split()))
	i = 0
	j = len(nums) - 1
	while j > i:
		elem.append(nums[i])
		elem.append(nums[j])
		i += 1
		j -= 1
	if length % 2 != 0:
		elem.append(nums[i])
	ans.append(elem)
for i in ans:
	print(' '.join((str(x) for x in i)))


t = int(input())
for i in range(t):
	n = int(input())
	s = input().split()
	m = int(n / 2)
	p = int((n - 1) / 2)
	ns = []
	fr = ''
	if n % 2 == 0:
		for j in range(m):
			ns.append(s[j])
			ns.append(s[n - 1 - j])
	else:
		for k in range(p):
			ns.append(s[k])
			ns.append(s[n - 1 - k])
		ns.append(s[p])
	for o in ns:
		fr += str(o) + ' '
	print(fr)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	ans = []
	left = 0
	right = n - 1
	while left < right:
		ans.append(l[left])
		ans.append(l[right])
		left += 1
		right -= 1
	if left == right:
		ans.append(l[left])
	print(*ans)


v = int(input())
for c in range(0, v):
	a = input()
	d = input()
	new = []
	str = ''
	b = d.split(' ')
	for i in range(0, len(b) // 2 + 1):
		new.append(b[i])
		new.append(b[-i - 1])
	for k in range(0, len(b)):
		str = str + new[k] + ' '
	print(str.rstrip())


t = int(input())
while t:
	t -= 1
	n = int(input())
	array = input().split()
	for i in range(0, int((n + 1) / 2)):
		print(array[i], end=' ')
		if n % 2 == 0 or i != int((n - 1) / 2):
			print(array[n - i - 1], end=' ')
	print(' ')


number_of_testcase = int(input())
result = [''] * number_of_testcase
for i in range(number_of_testcase):
	length = int(input())
	tmp = [0] * length
	arr = list(map(int, input().split()))
	low = 0
	high = length - 1
	left_or_right = 0
	for idx in range(len(tmp)):
		if left_or_right == 0:
			tmp[idx] = arr[low]
			low += 1
			left_or_right = 1
		else:
			tmp[idx] = arr[high]
			high -= 1
			left_or_right = 0
	result[i] = ' '.join((str(e) for e in tmp))
for line in result:
	print(line)


from pprint import pprint
import sys

def do():
	n = int(input())
	dat = list(map(int, input().split()))
	res = []
	l = 0
	r = n - 1
	while l != r:
		res.append(dat[l])
		l += 1
		if l == r:
			break
		res.append(dat[r])
		r -= 1
	res.append(dat[l])
	print(' '.join(list(map(str, res))))
q = int(input())
for _ in range(q):
	do()


def get_primeFactor(n):
	res = [1]
	x = 2
	while x * x <= n:
		while n % x == 0:
			res.append(x)
			n //= x
		x += 1
	if n > 1:
		res.append(n)
	return res

def getFactor(n):
	res = {1, n}
	x = 2
	while x * x <= n:
		if n % x == 0:
			res.add(x)
			res.add(n // x)
		x += 1
	return res

def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	if len(arr) <= 2:
		return ' '.join((str(i) for i in arr))
	res = ''
	for i in range(n // 2):
		res += '{} '.format(arr[i])
		res += '{} '.format(arr[n - i - 1])
	if n % 2 == 0:
		return res
	else:
		return res + str(arr[n // 2])
for _ in range(int(input())):
	print(solve())


skok = int(input())
for i in range(0, skok):
	new = []
	b = int(input())
	c = list(map(int, input().split()))
	while len(c) != 0:
		if len(c) == 1:
			new.append(c[0])
			c.pop(0)
		else:
			new.append(c[0])
			new.append(c[-1])
			c.pop(0)
			c.pop(-1)
	new = list(map(str, new))
	print(' '.join(new))


for _ in range(int(input())):
	n = int(input())
	seq = list(map(int, input().split()))
	while seq:
		print(seq.pop(0), end=' ')
		if seq:
			print(seq.pop(len(seq) - 1), end=' ')
	print()


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


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().strip().split()))
	l = len(arr)
	l1 = []
	l2 = []
	flag = 0
	if l % 2 != 0:
		x = arr[l // 2]
		flag = 1
		l1 = arr[:l // 2]
		l2 = arr[l // 2 + 1:]
	else:
		l1 = arr[:l // 2]
		l2 = arr[l // 2:]
	l2.reverse()
	num = n
	j = 0
	i = 0
	ans = [0] * n
	p = len(l1)
	while p > 0:
		ans[j] = l1[i]
		j += 1
		ans[j] = l2[i]
		j += 1
		i += 1
		p -= 1
	if flag == 1:
		ans[j] = x
	print(*ans)
	t -= 1


import sys
from collections import deque
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	nums = list(map(int, sys.stdin.readline().split()))
	nums = deque(nums)
	sw = 0
	while nums:
		if sw == 0:
			print(nums.popleft(), end=' ')
			sw = 1
			continue
		else:
			print(nums.pop(), end=' ')
			sw = 0
			continue
	print()