A permutation of length $n$ is an array consisting of $n$ distinct integers from $1$ to $n$ in arbitrary order. For example, $[2,3,1,5,4]$ is a permutation, but $[1,2,2]$ is not a permutation ($2$ appears twice in the array) and $[1,3,4]$ is also not a permutation ($n=3$ but there is $4$ in the array).

Let $p$ be any permutation of length $n$. We define the fingerprint $F(p)$ of $p$ as the sorted array of sums of adjacent elements in $p$. More formally,

$$F(p)=\mathrm{sort}([p_1+p_2,p_2+p_3,\ldots,p_{n-1}+p_n]).$$

For example, if $n=4$ and $p=[1,4,2,3],$ then the fingerprint is given by $F(p)=\mathrm{sort}([1+4,4+2,2+3])=\mathrm{sort}([5,6,5])=[5,5,6]$.

You are given a permutation $p$ of length $n$. Your task is to find a different permutation $p'$ with the same fingerprint. Two permutations $p$ and $p'$ are considered different if there is some index $i$ such that $p_i \ne p'_i$.


-----Input-----

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 668$). Description of the test cases follows.

The first line of each test case contains a single integer $n$ ($2\le n\le 100$)  — the length of the permutation.

The second line of each test case contains $n$ integers $p_1,\ldots,p_n$ ($1\le p_i\le n$). It is guaranteed that $p$ is a permutation.


-----Output-----

For each test case, output $n$ integers $p'_1,\ldots, p'_n$ — a permutation such that $p'\ne p$ and $F(p')=F(p)$.

We can prove that for every permutation satisfying the input constraints, a solution exists.

If there are multiple solutions, you may output any.


-----Example-----
Input
3
2
1 2
6
2 1 6 5 4 3
5
2 4 3 1 5

Output
2 1
1 2 5 6 3 4
3 1 5 2 4



-----Note-----

In the first test case, $F(p)=\mathrm{sort}([1+2])=[3]$.

And $F(p')=\mathrm{sort}([2+1])=[3]$.

In the second test case, $F(p)=\mathrm{sort}([2+1,1+6,6+5,5+4,4+3])=\mathrm{sort}([3,7,11,9,7])=[3,7,7,9,11]$.

And $F(p')=\mathrm{sort}([1+2,2+5,5+6,6+3,3+4])=\mathrm{sort}([3,7,11,9,7])=[3,7,7,9,11]$.

In the third test case, $F(p)=\mathrm{sort}([2+4,4+3,3+1,1+5])=\mathrm{sort}([6,7,4,6])=[4,6,6,7]$.

And $F(p')=\mathrm{sort}([3+1,1+5,5+2,2+4])=\mathrm{sort}([4,6,7,6])=[4,6,6,7]$.

Source: codeforces | Difficulty: EASY
Tags: Constructive algorithms


Solutions:
for _ in range(int(input())):
	input()
	print(*[*map(int, input().split())][::-1])


for i in range(int(input())):
	l = int(input().rstrip())
	lis = list(input().split())
	lis.reverse()
	ans = ' '.join(lis)
	print(ans)


t = int(input())
while t > 0:
	n = int(input())
	p = list(map(int, input().split()))
	p.reverse()
	print(*p)
	t -= 1


import math
for z in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a = a[::-1]
	for i in range(n):
		print(a[i], end=' ')
	print()


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math

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

def get_tuple():
	return map(int, stdin.readline().split())

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

def solve():
	n = get_int()
	ls = get_list()
	print(*ls[::-1])

def main():
	solve()
TestCases = True
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


for _ in range(int(input())):
	n = int(input())
	p = [*list(map(int, input().split()))][::-1]
	print(*p)


def solve():
	out = []
	no_of_test_cases = int(input())
	for i in range(no_of_test_cases):
		no_of_elements = int(input())
		permutation = input().split()
		permutation.reverse()
		print(' '.join((str(x) for x in permutation)))
solve()


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
for _ in range(inn()):
	n = inn()
	a = arr()
	a.reverse()
	print(*a)


from math import ceil
from sys import stdin, stdout, setrecursionlimit
from random import randint
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	for i in range(n - 1, -1, -1):
		print(a[i], end=' ')
	print()


query = int(input())
for _ in range(query):
	n = int(input())
	a = list(map(int, input().split()))
	print(' '.join(map(str, a[::-1])))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.reverse()
	print(*a)


def main(input_path=0):
	with open(input_path) as f:
		t = int(f.readline().strip())
		for _ in range(t):
			n = int(f.readline().strip())
			permutation = f.readline().strip().split(' ')
			print(' '.join(reversed(permutation)))
main()


import math
import sys
from sys import stdin, stdout
sys.setrecursionlimit(100000)
MOD = 10 ** 9 + 7
int_input = lambda : int(stdin.readline())
list_input = lambda : list(map(int, stdin.readline().split()))
sum_of_digit = lambda n: sum(map(int, list(str(n))))

def factors(n):
	fact = [1, n]
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			fact.append(i)
			if n // i != i:
				fact.append(n // i)
	return fact

def sieve(n):
	primes = [True] * (n + 1)
	(primes[0], primes[1]) = (False, False)
	for i in range(2, int(math.sqrt(n)) + 1):
		if primes[i]:
			for j in range(i * i, n + 1, i):
				primes[j] = False
	return primes
for _ in range(int_input()):
	n = int_input()
	l = list_input()
	l.reverse()
	print(*l)


for t in range(int(input())):
	input()
	p = [int(e) for e in input().split()]
	p.reverse()
	print(*p)


T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	print(*reversed(a))


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	st = list(map(str, input().split(' ')))
	st.reverse()
	ans.append(' '.join(st))
for ass in ans:
	print(ass)


import sys
input = iter(sys.stdin.read().splitlines()).__next__
sys.setrecursionlimit(10000)
TC = int(input())
for tc in range(TC):
	N = int(input())
	P = list(map(int, input().split()))
	res = P[::-1]
	print(' '.join(map(str, res)))


t = int(input())
for i in range(t):
	input()
	p = input().split(' ')
	p.reverse()
	print(' '.join(p))


for i in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	print(*arr[::-1])


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	print(*reversed(p))


t = int(input())
while t != 0:
	n = int(input())
	l = [int(i) for i in input().split()]
	l.reverse()
	for i in range(n):
		print(l[i], end=' ')
	print(end='\n')
	t = t - 1


import sys
import math
input = sys.stdin.readline

def gen_perms(n):
	used = [False for i in range(n)]
	p = []

	def gen(pos):
		if pos == n:
			yield p
		for i in range(n):
			if not used[i]:
				used[i] = True
				p.append(i + 1)
				yield from gen(pos + 1)
				p.pop()
				used[i] = False
	yield from gen(0)

def fingerprint(p):
	sums = []
	for i in range(len(p) - 1):
		sums.append(p[i] + p[i + 1])
	sums.sort()
	return sums
T = int(input())
for t in range(T):
	n = int(input())
	A = list(map(int, input().split(' ')))
	A = list(reversed(A))
	print(' '.join(map(str, A)))


t = int(input())
for i in range(t):
	p = input()
	print(*input().split()[::-1])


n = int(input())
for i in range(n):
	k = int(input())
	s = input().split()
	ss = []
	for j in range(len(s)):
		ss.append(s[k - j - 1])
	print(' '.join(ss))


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.reverse()
	print(*arr)


for _ in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	b.reverse()
	for elem in b:
		print(elem, end=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	perm = input().split()
	print(' '.join(perm[::-1]))


for i in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.reverse()
	print(*a)


for _ in range(0, int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	c = b[::-1]
	print(*c)


for i in range(int(input())):
	n = int(input())
	(*a,) = map(int, input().split())
	print(*a[::-1])


import io, os
inp = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
inar = lambda : list(map(int, inp().split()))
inin = lambda : int(inp())
inst = lambda : inp().decode().strip()
_T_ = inin()
for _t_ in range(_T_):
	n = inin()
	a = inar()
	print(*a[::-1])


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = reversed(arr)
	print(*arr)


x = int(input())
for z in range(x):
	n = int(input())
	l = list(map(int, input().split()))
	l = l[::-1]
	print(*l)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	for i in range(n):
		print(l[n - i - 1], end=' ')
	print()


for i in range(int(input())):
	s = int(input())
	a = [k for k in input().split()]
	a.reverse()
	print(' '.join(a))


def generate_permutation(arr):
	return arr[::-1]
t = int(input())
while t > 0:
	n = int(input())
	arr = input().split()
	arr = [int(c) for c in arr]
	res = generate_permutation(arr)
	print(*res)
	t -= 1


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

def out(ret):
	print(ret)

def outlt(ret):
	print(' '.join(list(map(str, ret))))

class Solution:

	def main(self, p):
		return p[::-1]
t = inp()
solution = Solution()
for _ in range(t):
	n = inp()
	p = inlt()
	outlt(solution.main(p))


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

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

def ws(s):
	sys.stdout.write(s + '\n')

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math
from collections import defaultdict
for _ in range(ri()):
	n = ri()
	l = ria()
	print(*l[::-1])


import sys
intinp = lambda : int(input())

def listinp(func=int):
	return list(map(func, input().split()))

def nsepline(n, func=str):
	return [func(input()) for _ in range(n)]

def printlist(li, glue=' '):
	return glue.join(list(map(str, li)))

def fop(s, end='\n'):
	sys.stdout.write(str(s) + end)

def fip():
	return sys.stdin.readline().strip()
fintinp = lambda : int(fip())

def flistinp(func=int):
	return list(map(func, fip().split()))

def fnsepline(n, func=str):
	return [func(fip()) for _ in range(n)]

def cfp(l):
	fp = []
	for i in range(1, len(l)):
		fp.append(p[i - 1] + p[i])
	return fp

def chk(l):
	return set(l) == set(range(1, len(l) + 1))

def cr(n, l):
	p = []
	p.append(n)
	p.append(l[0] - n)
	for i in range(1, len(l)):
		p.append(l[i] - p[-1])
	return p
for _ in range(fintinp()):
	n = fintinp()
	p = flistinp()
	print(*p[::-1])


import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.reverse()
	print(*arr)
	t -= 1


n = int(input())
for i in range(n):
	k = int(input())
	L = [i for i in input().strip('\r').split(' ')]
	L.reverse()
	print(' '.join(L))


for i in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	print(*list(reversed(b)))


import sys
import math
input = sys.stdin.readline

def inInt():
	return int(input())

def inStr():
	return input().strip('\n')

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

def inSList():
	return input().split()

def solve(n, p):
	p.reverse()
	ret = ''
	for x in p:
		if ret == '':
			ret = str(x)
		else:
			ret = ret + ' ' + str(x)
	return ret
tasks = inInt()
for t in range(tasks):
	n = inInt()
	p = inIList()
	print(solve(n, p))


for _ in range(int(input())):
	n = int(input())
	A = [int(_) for _ in input().split()]
	A = list(reversed(A))
	print(*A)


for _ in range(int(input())):
	int(input())
	print(*reversed(list(map(int, input().split()))))


import sys
t = int(input())
for _ in range(t):
	n = int(sys.stdin.readline().rstrip())
	arr = list(map(int, sys.stdin.readline().rstrip().split()))
	arr.reverse()
	for i in arr:
		print(i, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	list1 = list(map(int, input().strip().split()))
	for i in range(n):
		print(list1[n - 1 - i], end=' ')
	print()


import sys
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.reverse()
	print(*a)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	nList = list(map(int, input().split()))
	print(*nList[::-1])


t = int(input())
for u in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	p = reversed(a)
	for j in p:
		print(j, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	num = list(map(int, input().split()))
	for i in range(len(num) - 1, -1, -1):
		print(num[i], end=' ')
	print('')


t = int(input())
while t > 0:
	n = int(input())
	arr = [int(i) for i in input().split()]
	print(*arr[::-1], sep=' ')
	t -= 1


def solve():
	n = int(input())
	arr = list(map(int, input().strip().split()))
	arr = arr[::-1]
	for i in arr:
		print(i, end=' ')
	print()
t = int(input())
while t != 0:
	t -= 1
	solve()


t = int(input())
res = []
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	p.reverse()
	res.append(p)
for i in res:
	for j in i:
		print(j, end=' ')
	print('')


for i in range(int(input())):
	n = int(input())
	print(' '.join(list(input().split())[::-1]))


test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	for a in arr[::-1]:
		print(a, end=' ')
	print()


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 998244353
EPS = 1e-06

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	n = Int()
	a = array()
	print(*a[::-1])


t = int(input())
for h in range(t):
	n1 = int(input())
	n = list(map(int, input().split()))
	i = 0
	n = n[::-1]
	print(*n)


from sys import stdin, gettrace
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	n = int(inputi())
	aa = [int(a) for a in inputi().split()]
	print(' '.join(map(str, aa[::-1])))

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


def fun(ls):
	l = reversed(ls)
	print(*l)
T = int(input())
for i in range(T):
	ls = input().split()
	ls = list(map(int, ls))
	ls = input().split()
	ls = list(map(int, ls))
	fun(ls)


cases = int(input())
for _ in range(cases):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.reverse()
	print(*arr, sep=' ')


def rev(i):
	i.reverse()
	return i

def print_iterator(it):
	for x in it:
		print(x, end=' ')
	print('')
a = int(input(''))
arno = []
arar = []
opar = []
for i in range(a):
	b = int(input(''))
	c = input('').split()
	d = []
	for e in c:
		d.append(int(e))
	arno.append(b)
	arar.append(d)
for a in arar:
	opar.append(rev(a))
for a in opar:
	mapi = map(lambda x: x, a)
	print_iterator(mapi)


for _ in range(int(input())):
	n = int(input())
	lst = [int(i) for i in input().split()]
	print(*lst[::-1])


t = int(input())
for i in range(t):
	n = int(input())
	a = []
	a = [int(a) for a in input().split()]
	a.reverse()
	for j in range(n):
		print(a[j], end=' ')
	print(' ')


for _ in range(int(input())):
	input()
	p = list(map(int, input().split()))
	while len(p) > 0:
		print(p.pop(), end=' ')
	print()


from __future__ import division, print_function
import os, sys
import math
import collections
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

class my_dictionary(dict):

	def __init__(self):
		self = dict()

	def add(self, key, value):
		self[key] = value

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

def si():
	return input()

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

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def sli():
	return list(msi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def padded_bin_with_complement(x):
	if x < 0:
		return bin(2 ** 16 - abs(x))[2:].zfill(16)
	else:
		return bin(x)[2:].zfill(16)

def binaryToDecimal(binary):
	binary1 = binary
	(decimal, i, n) = (0, 0, 0)
	while binary != 0:
		dec = binary % 10
		decimal = decimal + dec * pow(2, i)
		binary = binary // 10
		i += 1
	print(decimal)

def CountFrequency(my_list):
	freq = {}
	for item in my_list:
		if item in freq:
			freq[item] += 1
		else:
			freq[item] = 1
	return freq

def pos(a):
	b = [0] * len(a)
	c = sorted(a)
	for i in range(len(a)):
		for j in range(len(a)):
			if c[j] == a[i]:
				b[i] = j
				break
	return b

def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n

def commonn(a, b, n):
	c = []
	for i in range(n):
		if a[i] == b[i]:
			c.append('-1')
		else:
			c.append(b[i])
	return c

def find_lcm(num1, num2):
	if num1 > num2:
		num = num1
		den = num2
	else:
		num = num2
		den = num1
	rem = num % den
	while rem != 0:
		num = den
		den = rem
		rem = num % den
	gcd = den
	lcm = int(int(num1 * num2) / int(gcd))
	return lcm

def sumdigit(n):
	n = str(n)
	k = 0
	for i in range(len(n)):
		k += int(n[i])
	return k

def main():
	for _ in range(ii()):
		n = ii()
		a = li()
		res = [0] * n
		for i in range(n):
			res[i] = a[n - i - 1]
		print(*res)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(*a[-1::-1])


t = int(input())
for tst in range(t):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	a = list(reversed(a))
	for x in a:
		print(x, end=' ')
	print()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	line = input().split(' ')
	numbers = []
	for i in line:
		numbers.insert(0, int(i))
	ans = ''
	for i in numbers:
		ans += str(i) + ' '
	print(ans.strip())


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(' '.join([str(x) for x in a[::-1]]))


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

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

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RA():
	return map(int, open(0).read().split())

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		(a1, ls) = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print((a1, a2), inp)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
show_flg = False
show_flg = True
ans = 0
for _ in range(I()):
	ans = 0
	n = I()
	a = LI()
	print(*a[::-1])


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	print(*a[::-1])


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	li = li[::-1]
	for item in li:
		print(item, end=' ')
	print('')


for _ in range(int(input())):
	n = int(input())
	p = [int(i) for i in input().split()]
	p.reverse()
	print(*p)


from sys import stdin, stdout
t = int(stdin.readline())
for i in range(t):
	n = int(stdin.readline())
	p = stdin.readline().split()
	p.reverse()
	print(' '.join(p))


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	a.reverse()
	print(*a, sep=' ')


for i in range(int(input())):
	n = int(input())
	x = [int(num) for num in input().split()]
	x.reverse()
	print(*x, sep=' ')


def solve():
	n = int(input())
	l = list(map(int, input().split()))
	print(*l[::-1])
t = int(input())
while t:
	t -= 1
	solve()


testCases = input()
for i in range(int(testCases)):
	n = int(input())
	arr = list(map(int, input().split()))
	rev_list = arr[::-1]
	print(' '.join([str(i) for i in rev_list]))


for i in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	print(*l[::-1])


for x in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()][:n]
	for x in range(n - 1, -1, -1):
		print(a[x], end=' ')
	print('')


t = int(input())
for i in range(t):
	n = int(input())
	p = input().split()
	p = list(map(int, p))
	p.reverse()
	for j in range(len(p)):
		print(p[j], end=' ')


import bisect
import copy
import fractions
import functools
import heapq
import math
import random
import sys
T = int(input())
for t in range(T):
	N = int(input())
	P = list(input().split())
	print(' '.join(reversed(P)))


import sys
input = sys.stdin.buffer.readline

def solution():
	n = int(input())
	l = list(map(int, input().split()))
	l.reverse()
	print(*l)
t = int(input())
for _ in range(t):
	solution()


n = int(input())
for i in range(n):
	s = int(input())
	r = [int(x) for x in input().split()]
	for j in range(s):
		print(r[s - j - 1], end=' ')
	print()


l = []
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s = []
	for i in range(n):
		s.append(str(a[n - i - 1]))
	l.append(' '.join(s))
for i in l:
	print(i)


lst = []
m = int(input())
for i in range(0, m):
	i = i + 1
	n = int(input())
	a = list(map(int, input().strip().split()))[:n]
	arr = []
	arr = a[::-1]
	for z in range(len(arr)):
		print(arr[z], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	p = input().split()
	print(' '.join(p[::-1]))


t = int(input())
for _ in range(t):
	n = int(input())
	list1 = list((int(n) for n in input().split()))
	list1.reverse()
	print(*list1)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for j in range(n):
		print(a[n - 1 - j], end=' ')
	print('')


import sys
from math import sqrt
from collections import defaultdict
inpt = sys.stdin.readline

def inp():
	return int(inpt())

def inlist():
	return list(map(int, inpt().split()))

def instr():
	s = inpt()
	return list(s[:len(s) - 1])

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

class Graph:

	def __init__(self, n):
		self.n = n
		self.graph = defaultdict(list)
		self.marked = defaultdict(int)

	def addEdge(self, u, v):
		self.graph[u].append(v)
		self.graph[v].append(u)

	def dfs(self, u):
		self.marked[u] = 1
		for i in self.graph[u]:
			if self.marked[i] == 0:
				self.dfs(i)

def main():
	t = inp()
	for l in range(t):
		n = inp()
		p = inlist()
		p.reverse()
		for i in range(n):
			print(p[i], end=' ')
		print()
main()


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	n = iinput()
	a = linput()
	a.reverse()
	print(*a)


for _ in range(int(input())):
	a = input()
	print(*input().split()[::-1])


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	result = arr[::-1]
	print(' '.join(map(str, result)))


n = int(input())
for _ in range(n):
	m = int(input())
	a = list(map(int, input().split(' ')))
	a.reverse()
	print(' '.join((str(i) for i in a)))


t = int(input())
for i in range(t):
	n = int(input())
	perm = list(map(int, input().split()))
	t = []
	if n % 2 == 0:
		x = perm[:n // 2]
		y = perm[n // 2:]
		t.extend(y[::-1])
		t.extend(x[::-1])
		for i in t:
			print(i, sep='', end=' ')
	else:
		x = perm[:n // 2]
		y = perm[n // 2 + 1:]
		t.extend(y[::-1])
		t.append(perm[n // 2])
		t.extend(x[::-1])
		for i in t:
			print(i, sep='', end=' ')
	print()


from math import ceil
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a = a[-1::-1]
	for i in a:
		print(i, end=' ')
	print()


def join(l):
	b = []
	for s in l:
		s = str(s)
		b.append(s)
	return ' '.join(b)
t = int(input())
i = 0
while i < t:
	n = int(input())
	p = list(map(int, input().split()))
	m = n + n - 1
	l = 0
	k = []
	while l < n - 1:
		if p[0] + p[1] != m:
			k.append(p[0])
			p.pop(0)
		elif p[0] + p[1] == m:
			k.append(p[0])
			p.pop(0)
			break
		l += 1
	p.reverse()
	k.reverse()
	print(join(p + k))
	i += 1


for _ in range(int(input())):
	n = int(input())
	L = [int(x) for x in input().split()]
	L.reverse()
	print(*L)


import os
import sys
from io import BytesIO, IOBase

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

def si():
	return input()

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

def li():
	return list(mi())

def main():
	for _ in range(ii()):
		n = ii()
		p = li()
		p.reverse()
		print(*p)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	n = int(input())
	x = [int(x) for x in input().split()]
	print(*x[::-1])


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	p.reverse()
	for i in range(n):
		print(p[i], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	r = list(map(int, input().split()))
	w = [r[i] + r[i + 1] for i in range(n - 1)]
	print(*r[::-1])


import itertools as it
t = int(input())
while t:
	n = int(input())
	li = list(map(int, input().split()))
	li.reverse()
	for i in li:
		print(i, end=' ')
	print()
	t -= 1


from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
	n = int(stdin.readline())
	p = list(map(int, stdin.readline().split()))
	p.reverse()
	print(*p)


for t in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split(' ')][::-1]
	print(*l)


for _ in range(int(input())):
	input()
	l = [int(x) for x in input().split()][::-1]
	print(*l)


for t in range(int(input())):
	n = int(input())
	num = list(map(int, input().split()))
	print(*num[::-1])


import sys
for i in range(0, int(sys.stdin.readline())):
	l = int(sys.stdin.readline())
	m = sys.stdin.readline().split()
	m = m[::-1]
	otp = ''
	for k in m:
		otp += k
		otp += ' '
	otp += '\n'
	sys.stdout.write(otp)


t = int(input())
for _ in range(t):
	n = int(input())
	ps = list(map(int, input().split()))
	ps.reverse()
	print(' '.join(list(map(str, ps))))


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a = reversed(a)
	print(*a)


import math
import sys
from collections import defaultdict

def stdinWrapper():
	data = '3\n2\n1 2\n6\n2 1 6 5 4 3\n5\n2 4 3 1 5\n'
	for line in data.split('\n'):
		yield line
if '--debug' not in sys.argv:

	def stdinWrapper():
		while True:
			yield input()
inputs = stdinWrapper()

def inputWrapper():
	return next(inputs)

def getType(_type):
	return _type(inputWrapper())

def getArray(_type):
	return [_type(x) for x in inputWrapper().split()]

def solve(data):
	return ' '.join([str(x) for x in reversed(data)])
t = getType(int)
for _ in range(t):
	n = getType(int)
	data = getArray(int)
	print(solve(data))


T = int(input())
for case in range(T):
	i = int(input())
	ls = [x for x in input().split()]
	print(' '.join(ls[::-1]))


from sys import stdin, stdout

def input():
	a = stdin.readline()
	if a[-1] == '\n':
		a = a[:-1]
	return a

def print(*argv, end='\n', sep=' '):
	n = len(argv)
	for i in range(n):
		if i == n - 1:
			stdout.write(str(argv[i]))
		else:
			stdout.write(str(argv[i]) + sep)
	stdout.write(end)
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def comb(lst, x):
	return list(c(lst, x))

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	lst = []
	for i in range(n):
		temp = [default] * m
		lst.append(temp)
	return lst

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def smaller(lst, x):
	return bisect_left(lst, x) - 1

def smallerEq(lst, x):
	return bisect_right(lst, x) - 1

def solve(n, lst):
	for i in lst[::-1]:
		print(i, end=' ')
	print()
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	solve(n, lst)


def solve():
	n = int(input())
	a = [int(i) for i in input().split()][::-1]
	return ' '.join([str(i) for i in a])
t = int(input())
ans = []
while t:
	ans.append(str(solve()))
	t -= 1
print('\n'.join(ans))


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


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
for case in range(int(input())):
	n = int(input())
	p = [int(x) for x in input().split()]
	print(*p[::-1])


for _ in range(int(input())):
	n = int(input())
	per = list(map(int, input().split()))
	per.reverse()
	print(*per)


def ans():
	N = int(input())
	for i in range(N):
		A = int(input())
		B = input().split()
		c = []
		for j in range(A - 1, -1, -1):
			if j != 0:
				print(int(B[j]), end=' ')
			else:
				print(int(B[j]))
ans()


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop, heapify
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
from itertools import accumulate
from functools import lru_cache
M = mod = 10000

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	l = li()
	print(*l[::-1])


def perm(arr):
	return ' '.join(arr[::-1])
t = int(input())
for u in range(t):
	x = input()
	print(perm(list(input().strip().split())))


myList = []
for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	l = p[::-1]
	myList.append(l)
for elem in myList:
	print(*elem)


n = int(input())
for i in range(0, n):
	n1 = int(input())
	l = list(map(int, input().split()))
	for j in range(n1 - 1, -1, -1):
		print(l[j], end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	q = reversed(p)
	for i in q:
		print(i, end=' ')
	print()


A = []
i = []
t = int(input())
for h in range(t):
	y = int(input())
	s = list(input().split())
	s.reverse()
	A.append(s)
for k in range(t):
	print(*A[k])


import sys
import math

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

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

def iinp():
	return int(input())

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

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

def p(a):
	print(a)
for _ in range(iinp()):
	n = iinp()
	p = linp()
	p.reverse()
	print(*p)


n = int(input())
for i in range(n):
	t = int(input())
	arr = [int(i) for i in input().split()]
	arr = arr[::-1]
	for i in arr:
		print(i, end=' ')


from itertools import permutations
n = int(input())
for i in range(n):
	m = int(input())
	x = input().split()
	o = [x[i] + x[i + 1] for i in range(len(x) - 1)]
	if len(x) % 2 == 0:
		y = x[::-1]
		print(' '.join(y))
	elif len(x) % 2 == 1:
		y = x[::-1]
		p = permutations(y)
		for key in p:
			q = [key[i] + key[i + 1] for i in range(len(key) - 1)]
			if q.sort() == o.sort():
				print(' '.join(key))
				break


for t in range(int(input())):
	n = int(input())
	a = [str(x) for x in input().split()]
	a = a[::-1]
	print(' '.join(a))


from collections import Counter
from math import log, e, inf
t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(map(int, input().split(' ')))
	l.reverse()
	for i in range(n):
		print(l[i], end=' ')
	print()


import sys, math, bisect
from collections import Counter, defaultdict as dd

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

def out(var):
	sys.stdout.write(str(var))

def l():
	return list(sp())

def strl():
	return list(strsp())

def sp():
	return map(int, data().split())

def strsp():
	return map(str, data().split())
for _ in range(int(data())):
	n = int(input())
	a = l()
	print(*a[::-1])


rr = lambda : input().strip()
rri = lambda : int(rr())
rrm = lambda : list(map(int, rr().split()))
from sys import stdin, stdout, setrecursionlimit
from math import ceil

def sol():
	n = rri()
	lis = rrm()
	print(*lis[::-1])
	return

def main():
	T = rri()
	for t in range(1, T + 1):
		ans = sol()
main()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	out = p[::-1]
	print(*out)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	print(*ar[::-1])


try:
	t = int(input())
	while t > 0:
		n = int(input())
		lst = list(map(int, input().split()))
		for i in lst[::-1]:
			print(i, end=' ')
		print('\r')
		t -= 1
except:
	pass


T = int(input())
for t in range(T):
	n = int(input())
	a = input().split()
	d = False
	a.reverse()
	print(' '.join(a))


def main():
	answers = []
	t = int(input())
	for i in range(t):
		n = int(input())
		p = list(map(int, input().split()))
		p.reverse()
		answers.append(p)
	for answer in answers:
		print(' '.join(map(str, answer)))
main()


tc = int(input())
while tc:
	tc -= 1
	n = int(input())
	arr = list(input().split(' '))
	arr.reverse()
	for (idx, num) in zip(range(n - 1), arr):
		print(num, end=' ')
	print(arr[n - 1])


for _ in [0] * int(input()):
	input()
	print(*[*map(int, input().split())][::-1])


def main():
	for _ in range(int(input())):
		n = input()
		m = [int(i) for i in input().split()]
		print(' '.join((str(i) for i in m[::-1])))
main()


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	for j in range(1, n + 1):
		ans.append(arr[-j])
	print(' '.join((str(x) for x in ans)))


for _ in [*open(0)][2::2]:
	print(' '.join(_.split()[::-1]))


for _ in range(int(input())):
	n = int(input())
	arr = input().split()
	print(' '.join(arr[::-1]))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for i in reversed(a):
		print(i, end=' ')
	print('')


t = int(input())
for test in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr = arr[::-1]
	for i in range(n):
		if i == n - 1:
			print(arr[i])
		else:
			print(arr[i], end=' ')


import sys, math, heapq, copy
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right
from functools import cmp_to_key
from itertools import permutations, combinations, combinations_with_replacement
mod = 1000000007

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

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

def get_float():
	return float(sys.stdin.readline().strip())

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

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

def get_floats():
	return map(float, sys.stdin.readline().strip().split())

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

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

def list_floats():
	return list(map(float, sys.stdin.readline().strip().split()))
t = get_int()
for _ in range(t):
	n = get_int()
	l = list_ints()
	for i in range(n - 1, -1, -1):
		print(l[i], end=' ')
	print()


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	v = n - 1
	while v >= 0:
		print(a[v], end=' ')
		v -= 1
	print()


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		s = input().split()
		out = ''
		for i in range(n):
			out += s[n - i - 1] + ' '
		print(out.strip())
main()


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(input().split())
	l.reverse()
	for i in l:
		print(i, end=' ')
	print()


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		plst = list(map(int, input().split()))
		print(*plst[::-1])
main()


number_of_test_case = int(input())
result = list()
i = 0
while i < number_of_test_case:
	length_of_permutation = int(input())
	permutation = list(map(int, input().split()))
	p_dash = permutation[-1::-1]
	result.append(p_dash)
	i += 1
for j in result:
	print(*j)


T = int(input())
for _ in range(T):
	n = int(input())
	P = list(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		if i == 0:
			print(P[i])
		else:
			print(P[i], end=' ')


T = int(input())
for t in range(T):
	n = int(input())
	arr = input()
	print(' '.join(list(reversed(arr.split(' ')))))


t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	li = list(map(int, input().strip().split()))
	li.reverse()
	print(' '.join((str(x) for x in li)))


t = lambda : range(int(input()))
a = lambda : list(map(int, input().split()))
for _ in t():
	n = int(input())
	p = a()
	for i in range(len(p) - 1, -1, -1):
		print(p[i], end=' ')
	print('')


for test in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(*l[::-1])


for q in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(*a[::-1])


t = int(input())
while t:
	n = int(input())
	a = [int(i) for i in input().split()]
	for ele in a[::-1]:
		print(ele, end=' ')
	print()
	t -= 1


for s in [*open(0)][2::2]:
	print(*s.split()[::-1])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	for i in range(n, 0, -1):
		print(l[i - 1], end=' ')
	print()


def solve(a):
	return a[::-1]
for _ in range(int(input())):
	l = int(input())
	a = list(map(int, input().split()))
	print(*solve(a))


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	p1 = p[::-1]
	print(' '.join(map(str, p1)))


t = int(input())
for _ in range(0, t):
	n = int(input())
	li = list(map(int, input().split()))
	for i in range(n):
		print(li[n - i - 1], end=' ')
	print()


T = int(input())
for t in range(T):
	input()
	p = input().split()
	print(*reversed(p))


t = int(input())
for _ in [0] * t:
	n = int(input())
	lst = list(map(int, input().split()))
	lst.reverse()
	for i in lst:
		print(i, end=' ')


for _ in range(int(input())):
	n = int(input())
	p = [int(i) for i in input().split()]
	res = [0 for i in range(n)]
	for i in range(n):
		res[i] = p[-i - 1]
	print(*res)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	arr = list(inp())
	arr = arr[::-1]
	print(*arr)


for _ in range(int(input())):
	n = int(input())
	a = input().split()
	a.reverse()
	print(*a)


import itertools

def printX(A):
	for x in A:
		print(x, end=' ')
n = int(input())
for x in range(n):
	N = int(input())
	A = list(map(int, input().split()))
	if N & 1:
		fingerprint = [A[x] + A[x + 1] for x in range(len(A) - 1)]
		fingerprint.sort()
		pointerF = 0
		pointerL = N - 1
		while pointerF != pointerL:
			(A[pointerF], A[pointerL]) = (A[pointerL], A[pointerF])
			pointerF += 1
			pointerL -= 1
		fingerprint1 = [A[x] + A[x + 1] for x in range(len(A) - 1)]
		fingerprint1.sort()
		printX(A)
		print()
	else:
		printX(reversed(A))
		print()


def main():
	for test in range(int(input())):
		_ = int(input())
		p = input().split()
		print(lts(solution(p)))

def solution(p):
	return p[::-1]

def lts(l):
	s = ''
	for i in l:
		s += i + ' '
	return s[:-1]
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if n % 2 == 1:
		m = n // 2
		l1 = list(reversed(a[:m]))
		l2 = list(reversed(a[m + 1:]))
		l2.append(a[m])
		ans = l2 + l1
		print(*ans)
	else:
		m = n // 2
		l1 = list(reversed(a[:m]))
		l2 = list(reversed(a[m:]))
		ans = l2 + l1
		print(*ans)


import sys
for i in range(int(sys.stdin.readline().strip())):
	n = int(sys.stdin.readline().strip())
	s = sys.stdin.readline().strip().split()
	s.reverse()
	print(' '.join(s))


for q in [*open(0)][2::2]:
	print(*q.split()[::-1])


from itertools import permutations
from collections import defaultdict
from math import *
import os
import sys
from io import BytesIO, IOBase
from heapq import nlargest
from bisect import *
import copy
import itertools
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		print(arr[i], end=' ')
	print()


def algo(n, arr):
	return ' '.join(reversed(arr))
for _ in range(int(input())):
	n = int(input())
	arr = input().split()
	ans = algo(n, arr)
	print(ans)


n = int(input())
for i in range(0, n):
	l = int(input())
	a = list(map(int, input().strip().split()))
	t = []
	for i in range(len(a) - 1, -1, -1):
		t.append(a[i])
	print(*t)


def Print(a):
	for i in a:
		print(i, end=' ')
	print()
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.reverse()
	Print(a)


import os
from sys import stdin, stdout

def solve(tc):
	n = int(stdin.readline().strip())
	seq = list(map(int, stdin.readline().split()))
	print(' '.join(map(lambda x: str(x), seq[::-1])))
tcs = 1
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


t = int(input())
while t:
	n = int(input())
	b = list(map(int, input().split()))
	a = []
	for i in range(n - 1, 0, -1):
		print(b[i], end=' ')
	print(b[0])
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	z = [int(x) for x in input().split(' ')]
	z.reverse()
	print(*z)


t = int(input())
for _ in range(t):
	n = int(input())
	perm = [int(i) for i in input().split()]
	for i in perm[-1::-1]:
		print(i, end=' ')


def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	for p in range(n + 1):
		if prime[p]:
			print(p)
nV = 4
INF = 999

def floyd_warshall(G):
	distance = list(map(lambda i: list(map(lambda j: j, i)), G))
	for k in range(nV):
		for i in range(nV):
			for j in range(nV):
				distance[i][j] = min(distance[i][j], distance[i][k] + distance[k][j])
	print_solution(distance)
from collections import defaultdict

def print_solution(distance):
	for i in range(nV):
		for j in range(nV):
			if distance[i][j] == INF:
				print('INF', end=' ')
			else:
				print(distance[i][j], end='  ')
		print(' ')
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		print(l[i], end=' ')
	print()


n = int(input(''))

def search(List, newList, length, sig, oList):
	if len(newList) == length and newList != oList:
		newSig = [int(newList[e]) + int(newList[e + 1]) for e in range(len(newList)) if e < len(newList) - 1]
		newSig.sort()
		valid = True
		for i in range(length):
			if oList[i] == newList[i]:
				valid = False
				break
		if valid and newSig == sig:
			return newList
	i = 0
	for char in List:
		ll = List.copy()
		del ll[i]
		ret = search(ll, newList + [char], length, sig, oList)
		if ret:
			return ret
		i += 1
	return None
for _ in range(n):
	l = input('')
	p = input('').split(' ')
	p.reverse()
	print(' '.join(p))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(p) for p in input().split()]
	rev = list(reversed(arr))
	print(*rev)


import os
from heapq import heapify, heappop, heappush
import sys
import math
import operator
import bisect
from collections import defaultdict
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		ar = inpt()
		ar = ar[::-1]
		for i in ar:
			print(i, end=' ')
		print()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
l = []
n = []
for _ in range(t):
	n.append(int(input()))
	l.append([int(i) for i in input().split()])

def check(n, p):
	if n == 2:
		return [p[1], p[0]]
	if n == 3:
		return [p[-1], p[1], p[0]]
	for i in range(n // 2):
		(p[i], p[-(i + 1)]) = (p[-(i + 1)], p[i])
	return p
res = []
for i in range(t):
	res.append(check(n[i], l[i]))
for i in res:
	print(*i)


def input_int():
	return int(input())

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

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

def run():
	q_num = input_int()
	for _ in range(q_num):
		a = input_int()
		nums = input_int_list()
		reversed_nums = nums[::-1]
		print(' '.join(map(str, reversed_nums)))
run()


for T in range(int(input())):
	n = int(input())
	l = input().split()
	print(*l[::-1])


for o in range(int(input())):
	n = int(input())
	s = list(map(str, input().split()))
	s = s[::-1]
	s = ' '.join(s)
	print(s)


t = int(input())
while t > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	for i in range(len(arr)):
		print(arr[len(arr) - 1 - i], end=' ')
	t -= 1


import math
t = int(input())
for w in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	print(*reversed(l))


import sys
input = sys.stdin.readline
read = lambda : map(int, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def lcm(a, b):
	return a * b // gcd(a, b)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math
from bisect import bisect_left

def solve():
	n = int(input())
	a = list(read())
	print(*a[-1::-1])
for _ in range(int(input())):
	solve()


def solve():
	n = int(input())
	l = list(map(int, input().split()))
	for i in range(n // 2):
		a = l[i]
		l[i] = l[n - i - 1]
		l[n - i - 1] = a
	return l
for _ in range(int(input())):
	p = solve()
	for i in p:
		print(i, end=' ')
	print()


for ii in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(*list(reversed(a)))


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	z = []
	for i in range(n - 1, -1, -1):
		z.append(a[i])
	print(*z, sep=' ')


t = int(input())
for case in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = list(reversed(arr))
	ans = list(map(str, ans))
	print(' '.join(ans))


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = input().split()
	l1.reverse()
	print(*l1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	s = l[::-1]
	print(*s)


import sys
import math
L = []
L1 = []
res = []
userIn = int(input())
for i in range(0, userIn):
	userIn2 = int(input())
	x = list(map(str, input().split()))
	L.append(x)
for i in range(0, len(L)):
	L[i].reverse()
	res.append(L[i])
for i in range(0, len(res)):
	print(' '.join(res[i]))


import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from itertools import permutations, product

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def inc(d, c, x=1):
	d[c] = d[c] + x if c in d else x

def bo(i):
	return ord(i) - ord('A')

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

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

def gh():
	sys.stdout.flush()

def isvalid(i, j):
	return 0 <= i < n and 0 <= j < n

def bo(i):
	return ord(i) - ord('a')

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)
t = fi()
while t > 0:
	t -= 1
	n = fi()
	a = li()
	print(*a[::-1])


def fun(arr, n):
	arr.reverse()
	print(*arr)
try:
	t = int(input())
	for i in range(t):
		n = int(input())
		arr = list(map(int, input().split()))
		fun(arr, n)
except:
	pass


l1 = []
for i in range(int(input())):
	n1 = int(input())
	l1 = list(map(int, input().strip().split()))[:n1]
	l1.reverse()
	for i in l1:
		print(i, end=' ')


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	print(' '.join(map(str, reversed(p))))


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
from collections import deque
from bisect import bisect_left
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.reverse()
	print(*l)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(input().split())
	l = l[::-1]
	l = ' '.join(l)
	print(l)


t = int(input())
while t:
	t -= 1
	n = int(input())
	print(*list(map(int, input().split()))[::-1])


import sys

def main():
	tn = int(input())
	for ti in range(tn):
		_ = int(input())
		A = [int(a) for a in input().split()]
		print(' '.join(map(str, reversed(A))))
main()


te = int(input())
while te:
	n = int(input())
	a = list(map(int, input().split()))
	a = a[::-1]
	print(' '.join(map(str, a)))
	te = te - 1


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	p2 = p[::-1]
	for c in p2:
		print(c, end=' ')
	print()


from sys import stdin, stdout
import heapq as hq
from collections import defaultdict
t = int(input())
for tc in range(t):
	n = int(stdin.readline())
	ar = list(map(int, stdin.readline().split()))
	ar = ar[::-1]
	res = ' '.join([str(x) for x in ar])
	stdout.write(str(res) + '\n')


from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	for i in range(n - 1, -1, -1):
		print(arr[i], end=' ')
	print()


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	a.reverse()
	print(*a)


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

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

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from decimal import Decimal
mod = int(1000000000.0) + 7
INF = 100000
for t in range(int(data())):
	n = int(data())
	p = mdata()
	outl(p[::-1])


a = int(input())
for i in range(0, a):
	b = int(input())
	c = list(map(str, input().split()))
	c.reverse()
	print(*c)


for t in range(int(input())):
	n = int(input())
	arr = [int(k) for k in input().split()]
	for ele in reversed(arr):
		print(ele, end=' ')
	print()


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

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

def read_floats():
	return list(map(float, input().strip().split()))

def read_str():
	return input().strip()

def solve():
	n = read_int()
	nums = read_ints()
	nums.reverse()
	print(*nums)

def read_input():
	t = read_int()
	for _ in range(t):
		solve()
read_input()


t = int(input())
for i in range(t):
	n = int(input())
	num_list = input().split()
	num_list.reverse()
	print(' '.join(num_list))


import sys
input = sys.stdin.readline
t = int(input())
for t1 in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	for i in range(n):
		l[i] = str(l[i])
	print(' '.join(l[::-1]))


testcases = int(input())
for _ in range(testcases):
	n = int(input())
	l = list(map(int, input().split()))
	print(*l[::-1])


t = int(input())
while t:
	n = int(input())
	a = [int(i) for i in input().split()]
	a = a[::-1]
	for i in range(len(a)):
		if i == n - 1:
			print(a[i])
			break
		print(a[i], end=' ')
	t -= 1


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	print(*reversed(l))


for i in ' ' * int(input()):
	n = int(input())
	L = list(map(int, input().split()))
	for j in L[::-1]:
		print(j, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	s = ''
	for i in range(1, len(arr)):
		s += str(arr[-i]) + ' '
	s += str(arr[0])
	print(s)


def solve(arr, n):
	print(*arr[n - 1::-1])
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	solve(arr, n)


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
input = sys.stdin.readline
import random
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(inin()):
	n = inin()
	l = ain()
	print(*l[::-1])


from collections import deque, defaultdict, Counter
from sys import stdin, stdout

def inp():
	return int(stdin.readline())

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

def insr():
	return list(stdin.readline().strip())

def invr():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def lds(arr, n):
	lds = [0] * n
	max = 0
	for i in range(n):
		lds[i] = 1
	for i in range(1, n):
		for j in range(i):
			if arr[i] < arr[j] and lds[i] < lds[j] + 1:
				lds[i] = lds[j] + 1
	for i in range(n):
		if max < lds[i]:
			max = lds[i]
	return max
import math

def solve():
	for _ in range(inp()):
		n = inp()
		a = inlt()
		x = list(reversed(a))
		print(*x)
solve()


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	N = int(input())
	arr = list(map(int, input().split()))
	print(*arr[::-1])


T = int(input())
for _ in range(T):
	n = int(input())
	l = [int(x) for x in input().split(' ')]
	l.reverse()
	for i in l:
		print(i, end=' ')
	print()


def solve():
	n = int(input())
	ls = list(map(int, input().split()))[::-1]
	print(*ls)
T = int(input())
for _ in range(T):
	solve()


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


t = int(input())
while t:
	n = int(input())
	po = input().split(' ')
	for i in range(0, len(po)):
		po[i] = int(po[i])
	po.reverse()
	print(*po)
	po = []
	t -= 1


import sys
import math
from math import *
from collections import Counter, defaultdict, deque
lip = lambda : list(map(int, input().split()))
ip = lambda : int(input())
sip = lambda : input().split()

def main():
	n = ip()
	arr = lip()
	arr.reverse()
	print(*arr)
for i in range(ip()):
	main()


for t in range(int(input())):
	n = int(input())
	print(' '.join(reversed(input().split())))


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l1 = l.copy()
	l1.reverse()
	print(' '.join(map(str, l1)))


import sys

def solve(arr):
	arr.reverse()
	return arr
caseCount = int(next(sys.stdin))
for i in range(caseCount):
	next(sys.stdin)
	x = next(sys.stdin)[:-1].split(' ')
	ans = solve(x)
	print(' '.join(ans))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = I()
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		rr.append(JA(a[::-1], ' '))
	return JA(rr, '\n')
print(main())


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


t = int(input())
for _ in range(t):
	n = int(input())
	p = [int(i) for i in input().split()]
	print(*p[::-1])


T = int(input())
for i in range(T):
	n = int(input())
	s = list(input().strip().split(' '))
	s = s[::-1]
	print(' '.join(s).strip())


cases = int(input())
for _ in range(cases):
	n = int(input())
	c = list(map(int, input().split()))
	print(*c[::-1])


t = int(input())
for i in range(t):
	a = int(input())
	b = [int(s) for s in input().split()]
	print(*b[::-1])


n = int(input())
for i in range(n):
	m = int(input())
	s = input().split(' ')
	a = []
	for c in s:
		a.append(int(c))
	a.reverse()
	for i in range(m):
		print(a[i], end=' ')
	print()


def ans_if_list(ans_list):
	return ' '.join((str(ans_list[i]) for i in range(len(ans_list))))
t = int(input())
for q in range(t):
	l = int(input())
	ls = list(map(int, input().split()))
	ans = list(reversed(ls))
	print(ans_if_list(ans))


from math import *
from collections import *
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	arr.reverse()
	print(*arr)


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	b = int(input())
	a = list(map(int, input().split()))
	print(*a[::-1])


t = int(input())
for i in range(t):
	n = int(input())
	s = list(map(int, input().split(' ')))
	print(*s[::-1])


n = int(input())
for i in range(n):
	x = int(input())
	line = list(map(int, input().split()))
	for j in reversed(line):
		print(j, end=' ')
	print('')


randuuid = 'd6bcdea9-2ae0-9562-c569-be43fa1e3573'
for _ in range(int(input())):
	input()
	print(*reversed(input().split()))


import os
import sys
import time
from io import BytesIO, IOBase
import random

def localInput():
	sys.stdin = open('inputf.in', 'r')
	sys.stdout = open('outputf.in', 'w')
	sys.stderr = open('error.txt', 'w')

def print_to_stderr(*a):
	print(*a, file=sys.stderr)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def solve():
	n = int(input())
	arr = [int(a) for a in input().strip().split(' ')]
	arr.reverse()
	print(*arr)

def main():
	test_cases = int(input())
	for test_units in range(test_cases):
		solve()
execution_time_start = time.clock()
main()
execution_time_stop = time.clock()
print_to_stderr('Total Time Taken: %f Seconds!' % (execution_time_stop - execution_time_start))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		print(' '.join(reversed(input().split())))
main()


t = int(input())
while t != 0:
	n = int(input())
	arr = list(map(int, input().split()))
	arr = arr[::-1]
	print(' '.join(map(str, arr)))
	t -= 1


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	print(*A[::-1])


def ans(p):
	return p[::-1]
t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().strip().split()))
	print(*ans(p))


import sys
import math
input = sys.stdin.readline
from collections import deque
from queue import LifoQueue
for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	p.reverse()
	print(*p)


import sys
T = int(sys.stdin.readline())
for i in range(T):
	N = int(sys.stdin.readline())
	nums = list(map(int, sys.stdin.readline().split()))
	print(' '.join([str(x) for x in nums[::-1]]))


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

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

def readMap():
	return map(int, input().split())
inf = float('inf')
mod = 10 ** 9 + 7
import math

def solve(n, A):
	A.reverse()
	return ' '.join(map(str, A))
t = readInt()
for _ in range(t):
	n = readInt()
	A = readList()
	print(solve(n, A))


t = int(input())
nlist = []
permutations = []
for _ in range(t):
	nlist.append(int(input()))
	permutations.append(list(input().split()))
for per in permutations:
	per.reverse()
	print(' '.join(per))


import sys

def _():
	return sys.stdin.readline()

def __():
	return sys.stdin.readline().split()
q = int(_())
for id in range(q):
	n = int(_())
	a = list(map(int, __()))
	a.reverse()
	print(*a)


t = int(input().split()[0])
for i in range(t):
	n = input()
	a = [int(x) for x in input().split()]
	a.reverse()
	print(*a)


import math
import os
import random
import re
import string
from sys import *
from collections import *

def bs(arr, x, l, r):
	if l <= r:
		mid = (r + l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return bs(arr, x, l, mid - 1)
		else:
			return bs(arr, x, mid + 1, r)
	else:
		return -1

def solve():
	for _ in range(int(input())):
		n = int(input())
		l = list(map(int, stdin.readline().strip().split()))
		l = l[::-1]
		print(*l)
solve()


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

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

def si():
	return input().rstrip()

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	for _ in range(ii()):
		n = ii()
		a = li()
		a.reverse()
		print(*a)
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


t = int(input())
while t > 0:
	n = int(input())
	p = list(map(int, input().split()))
	for i in p[::-1]:
		print(i, end=' ')
	print()
	t -= 1


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.reverse()
	print(*ar, sep=' ')


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(j) for j in input().split()][:n]
	arr.reverse()
	print(*arr)


for _ in range(int(input())):
	n = int(input())
	k = list(map(int, input().split()))
	k = list(reversed(k))
	for i in range(n):
		if i != n - 1:
			print(k[i], end=' ')
		else:
			print(k[i])


t = int(input())
for _ in range(t):
	input()
	p = [int(i) for i in input().split()]
	print(' '.join([str(p_i) for p_i in reversed(p)]))


t1 = int(input())
for _ in range(t1):
	n = int(input())
	t = ''
	a = list(map(str, input().split()))
	a.reverse()
	for i in a:
		t += i + ' '
	print(t[:-1])


def solve(val):
	s = [str(i) for i in val]
	return ' '.join(s[::-1])
i = int(input())
for x in range(i):
	p = int(input())
	lst = list(map(int, input().split()))
	print(solve(lst))


def lst(x):
	return list(map(int, x.split()))
t = int(input())
for _ in range(t):
	n = int(input())
	ar = lst(input())
	print(*list(reversed(ar)))


for i in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	s2 = reversed(s)
	print(*s2)


def solve(A):
	pass
t = int(input())
res = []
while t:
	length = int(input())
	arr = input().split(' ')
	res.append(list(reversed(arr)))
	t -= 1
for r in res:
	s = ' '.join(r)
	print(s)


import sys
from operator import itemgetter
input = sys.stdin.readline
from collections import defaultdict as dc
from bisect import bisect_left, bisect_right
import math
for n_ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(*l[::-1])


m = int(input())
r = []
for i in range(m):
	n = int(input())
	lstIn = [int(z) for z in input().split(' ')]
	r.append(lstIn[::-1])
for j in r:
	for k in j:
		print(k, end=' ')
	print('')


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	ans = [str(i) for i in p[::-1]]
	ans = ' '.join(ans)
	print(ans)


import sys
import random
from fractions import Fraction
from math import *

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

def iinput():
	return int(input())

def finput():
	return float(input())

def tinput():
	return input().split()

def linput():
	return list(input())

def rinput():
	return list(map(int, tinput()))

def fiinput():
	return list(map(float, tinput()))

def flinput():
	return list(fiinput())

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

def trinput():
	return tuple(rinput())

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

def NOYES(fl):
	if fl:
		print('NO')
	else:
		print('YES')

def YESNO(fl):
	if fl:
		print('YES')
	else:
		print('NO')

def main():
	n = iinput()
	q = rlinput()
	q.reverse()
	print(*q)
for TESTING in range(iinput()):
	main()


for _ in range(int(input())):
	n = int(input())
	l = input().split()
	l = l[::-1]
	print(*l)


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = mpos(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj
import sys
import threading
from math import *
sys.setrecursionlimit(300000)
threading.stack_size(10 ** 8)
po = int(log(10 ** 18)) + 2
li = []
for i in range(po):
	li.append(3 ** i)
li = li[::-1]
s = sum(li)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(*a[::-1])


t = int(input())
finalResult = []
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	fP = []
	newFP = []
	result = ''
	for j in range(len(p)):
		indexA = p[j]
		if indexA != p[len(p) - 1]:
			indexB = p[j + 1]
			fP.append(indexA + indexB)
		else:
			break
	fP.sort()
	newP = []
	for k in range(len(p) - 1, -1, -1):
		newP.append(p[k])
	check = 1
	for m in range(len(newP)):
		if p[m] == newP[m]:
			check &= 1
		else:
			check &= 0
	if check == 0:
		for j in range(len(newP)):
			indexA = newP[j]
			if indexA != newP[len(newP) - 1]:
				indexB = newP[j + 1]
				newFP.append(indexA + indexB)
			else:
				break
	newFP.sort()
	check2 = 1
	for k in range(len(newFP)):
		if fP[k] == newFP[k]:
			check2 &= 1
		else:
			check2 &= 0
	if check2 == 1:
		for n in range(len(newP)):
			result += str(newP[n]) + ' '
		finalResult.append(result)
for c in range(len(finalResult)):
	print(finalResult[c], end='\n')


import math as mt

def tran(arr):
	arr.reverse()
	return arr
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	arr = list(map(int, input().rstrip().split()))
	r = tran(arr)
	ans.append(r)
for i in ans:
	print(*i)


a = int(input())
for i in range(0, a):
	b = int(input())
	arr = list(map(int, input().split()))
	arr = arr[::-1]
	print(' '.join(map(str, arr)))


t = int(input())
for i in range(t):
	n = int(input())
	p = [int(i) for i in input().split()]
	p.reverse()
	for i in p:
		print(i, end=' ')
	print()


for _ in range(int(input())):
	num = int(input())
	arr = list(map(int, input().split()))
	arr.reverse()
	print(*arr)


n = int(input())
for j in range(n):
	l = int(input())
	p = input()
	p = p.split()
	p.reverse()
	p2 = str(p[0])
	for i in range(1, len(p)):
		p2 = p2 + ' ' + str(p[i])
	print(p2)


import math
from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if n % 2 == 0:
		a.reverse()
		print(*a)
	else:
		a.reverse()
		print(*a)


tst = int(input())
t = 1
while t <= tst:
	n = int(input())
	ls = list(map(int, input().split()))
	ls.reverse()
	i = 0
	while i < n:
		print(ls[i], end=' ')
		i += 1
	print('\r')
	t += 1


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(input().split())
	arr = [arr[-i] for i in range(1, n + 1)]
	print(' '.join(arr))


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
for __ in range(itg()):
	inp()
	print(*reversed(tuple(mpint())))


def findTwin(n, p):
	return reversed(p)
t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	print(*findTwin(n, p))


t = int(input())
for i in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	a = l[::-1]
	print(*a)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	k = n - 1
	for j in range(n // 2):
		(l[j], l[k]) = (l[k], l[j])
		k -= 1
	print(*l)


def ans():
	print(*a[::-1])
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans()


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(input().split())
	print(' '.join(reversed(a)))


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		P = [int(x) for x in input().split()]
		ans = list(reversed(P))
		print(*ans, sep=' ')
main()


a = int(input())
for i in range(a):
	n = int(input())
	x = list(map(int, input().split()))
	x.reverse()
	for i in x:
		print(i, end=' ')


from collections import Counter
from collections import defaultdict as dc
import sys
from heapq import *
import math
mod = 10 ** 9 + 7

def sinp():
	p = str(sys.stdin.readline())
	return p

def seive(n):
	p = [0] * (n + 1)
	for i in range(2, n):
		for j in range(2 * i, n + 1, i):
			p[i] = 1
	return p

def inp():
	p = int(sys.stdin.readline())
	return p

def line():
	p = list(map(int, sys.stdin.readline().split()))
	return p

def read_mat():
	n = inp()
	a = []
	for i in range(n):
		a.append(line())
	return a
from itertools import permutations as perm

def solve(t):
	n = inp()
	a = line()
	p = a[::-1]
	print(*p)
t = inp()
for test in range(t):
	solve(test)


test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.reverse()
	print(*arr)


for _ in range(int(input())):
	N = int(input())
	array = [int(x) for x in input().split()]
	print(*array[::-1])


import sys
import bisect
import math as mt
input = sys.stdin.readline
t = int(input())
mod = 10 ** 9 + 7
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.reverse()
	print(*l)


t = int(input())
for _ in range(t):
	input()
	l = reversed(list(map(int, input().split())))
	for e in l:
		print(e, end=' ')
	print()


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

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(n, p):
	return ' '.join([str(x) for x in p[::-1]])
t = read_int()
for case in range(t):
	n = read_int()
	p = read_ints()
	sol = solve(n, p)
	print(sol)


t = int(input())
for rr in range(t):
	n = int(input())
	f = list(map(int, input().split()))
	p = f[::-1].copy()
	[print(i, end=' ') for i in p]
	print()


T = int(input())
for t in range(T):
	n = int(input())
	p = list(input().split())
	print(' '.join(p[::-1]))


inp = ''
t = int(input())
for i in range(t):
	n = input()
	p = input().split()
	p = p[::-1]
	print(' '.join(p))


import sys, os, io
input = sys.stdin.readline
T = int(input())
ans = [0] * T
for t in range(T):
	N = int(input())
	P = list(map(int, input().split()))
	ans[t] = P[::-1]
for a in ans:
	print(*a)


t = int(input())
for j in range(0, t):
	n = int(input())
	a = list(map(str, input().split()))
	a.reverse()
	print(' '.join(a))


import collections
import itertools
import sys
from collections import defaultdict, Counter
from math import sqrt, ceil
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())

def main():
	n = inp()
	for _ in range(n):
		d = inp()
		v = inlt()
		print(' '.join([str(s) for s in reversed(v)]))
main()


import sys
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

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

def MI1():
	return map(int1, sys.stdin.readline().split())

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

def LI1():
	return list(map(int1, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]
dij = [(1, 0), (-1, 0), (0, 1), (0, -1)]
for _ in range(II()):
	n = II()
	aa = LI()
	print(*aa[::-1])


t = int(input())
for _ in range(t):
	n = int(input())
	hello = list(map(int, input().split()))
	hello.reverse()
	for i in hello:
		print(i, end=' ')
	print()


def solve():
	n = int(input())
	p = list(input().split())
	p.reverse()
	print(' '.join(p))
runs = int(input())
while runs > 0:
	solve()
	runs -= 1


def solve(n, p):
	return reversed(p)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		p = [int(x) for x in input().split()]
		assert n == len(p)
		permutation = solve(n, p)
		permutation = ' '.join([str(i) for i in permutation])
		print(permutation)
main()


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(j) for j in input().split()[:n]]
	s = str(a)
	b = a[len(a)::-1].copy()
	for k in range(len(b)):
		if k == len(b) - 1:
			print(b[k])
		else:
			print(b[k], end=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	ans = []
	for i in range(n):
		ans.append(p[n - 1 - i])
	print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list([int(x) for x in input().split()])
	l.reverse()
	print(*l)


for _ in range(int(input())):
	x = int(input())
	myList = list(map(int, input().split()))
	myList.reverse()
	print(*myList)


import math
from decimal import Decimal
import heapq
import copy
import heapq
from collections import deque
from collections import defaultdict
MOD = 1000000007

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(n):
	tc = []
	ans = {}
	d = 2
	while d * d <= n:
		if n % d == 0:
			tc.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		tc.append(n)
	for i in tc:
		ans[i] = ans.get(i, 0) + 1
	return ans

def to_zero(n, s):
	lst = s[0]
	ans = []
	for i in range(n):
		if lst == s[i]:
			continue
		elif lst == '0':
			lst = '1'
			ans.append(i)
		else:
			lst = '0'
			ans.append(i)
	if lst == '1':
		ans.append(n)
	return ans

def divs(n):
	ans = 0
	while n:
		ans += n % 10
		n = n // 10
	return ans
for _ in range(int(input())):
	(n, a) = na()
	print(*a[::-1])


case = int(input())
for i in range(case):
	input()
	lst = list(map(int, input().split(' ')))
	newlst = []
	newlst = lst[::-1]
	newlst = [str(x) for x in newlst]
	print(' '.join(newlst))


for _ in range(int(input())):
	n = int(input())
	w = input().split()
	print(*w[::-1])


import sys, collections
tc = int(sys.stdin.readline())
for _ in range(tc):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	arr.reverse()
	print(' '.join(map(str, arr)))


from sys import stdin
_input = stdin.readline
(_list, _reversed, _range, _int) = (list, reversed, range, int)

def solution():
	for _ in _range(_int(_input())):
		n = _int(_input())
		arr = [_int(i) for i in _input().split()]
		print(*_list(_reversed(arr)))
solution()


def get_perm(arr):
	return arr[::-1]
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(' '.join(map(str, get_perm(arr))))


t = int(input())
for i in range(0, t):
	m = int(input())
	arr = list(map(int, input().strip().split()))[:m]
	l = []
	for j in range(m - 1, -1, -1):
		l.append(arr[j])
	print(*l, sep=' ')


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for _ in range(t):
	(n,) = I()
	l = I()
	l = l[::-1]
	print(*l)


for cvj in range(int(input())):
	n = int(input())
	print(str(list(map(int, input().split()))[::-1])[1:-1].replace(',', ''))


t = int(input())
nlist = []
array = []
for i in range(t):
	nlist.append(int(input()))
	ar1 = list(map(int, input().split()))
	array.append(ar1)
for i in array:
	ar2 = i[::-1]
	for j in ar2:
		print(j, end=' ')


for _ in range(int(input())):
	n = int(input())
	arr = [int(j) for j in input().split()]
	arr.reverse()
	print(*arr)


import sys
import math
input = sys.stdin.readline

def get_int():
	return int(input())

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

def get_char_list():
	return list(input())
cases = get_int()
for _ in range(cases):
	n = get_int()
	ints = get_int_list()
	ints.reverse()
	print(*ints)


import sys
import math

def II():
	return int(sys.stdin.readline())

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

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

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	n = II()
	a = LI()
	print(*a[:][::-1])


s = input()
while True:
	try:
		s = input()
		s = ' '.join(list(map(str, list(map(int, input().split(' ')))[::-1])))
		print(s)
	except:
		break


for i in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	print(*lst[::-1])


T_ON = 1
DEBUG_ON = 0
MOD = 998244353

def solve():
	n = read_int()
	A = read_ints()
	print_nums(A[::-1])

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

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

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

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

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

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


t = int(input())
for tc in range(t):
	n = int(input())
	line = input().split()
	p = []
	for i in range(n):
		p.append(int(line[i]))
	for i in range(n - 1, -1, -1):
		print(p[i], end=' ')


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

def li():
	return [int(i) for i in input().split()]
for t in range(ii()):
	n = ii()
	p = li()
	p.reverse()
	print(*p)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(j) for j in input().split()]
	print(*arr[::-1])


from math import ceil
from collections import deque
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	for i in range(n - 1, -1, -1):
		print(a[i], end=' ')
	print()


T = int(input())
for t in range(T):
	input()
	P = input().split()
	print(*P[::-1])


T = int(input())
while T:
	n = int(input())
	A = list(map(int, input().split()))
	print(*A[::-1])
	T = T - 1


import sys
import math, bisect
sys.setrecursionlimit(10 ** 5)
from collections import defaultdict
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, OrderedDict

def I():
	return int(sys.stdin.readline())

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

def Neo():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(I()):
	N = I()
	A = Neo()
	A = A[::-1]
	print(*A)


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


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split(' ')))
	if arr == list(set(arr)):
		print(*arr[::-1])
	else:
		print(*arr[::-1])


import math
t = int(input())
for q in range(t):
	n = int(input())
	P = [int(i) for i in input().split()]
	for i in range(n - 1, -1, -1):
		print(P[i], end=' ')
	print()


t = int(input())
y = []
u = []
for i in range(t):
	r = int(input())
	e = list(map(int, input().split()))
	y.append(r)
	u.append(e)

def tully(u):
	return u
for j in range(t):
	e = tully(u[j])
	for i in range(y[j] - 1, -1, -1):
		print(u[j][i], end=' ')


import sys, math, bisect
from heapq import *
inf = float('inf')
mod = 10 ** 9 + 7

def lcm(a, b):
	return int(a / math.gcd(a, b) * b)

def gcd(a, b):
	return int(math.gcd(a, b))

def tobinary(n):
	return bin(n)[2:]

def binarySearch(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def lowerBound(a, x):
	i = bisect.bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def upperBound(a, x):
	i = bisect.bisect_right(a, x)
	if i != len(a) + 1 and a[i - 1] == x:
		return i - 1
	else:
		return -1

def SieveOfEratosthenes(n):
	ans = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			ans.append(p)
	return ans
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	print(*arr[::-1])


for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.reverse()
	print(*ar)


test = int(input())
for t in range(0, test):
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	a.reverse()
	for e in a:
		print(e, end=' ')
	print()


import sys as _sys

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		p = tuple(read_ints())
		result = find_pseudo_p(p)
		print(*result)

def read_ints():
	return map(int, _sys.stdin.readline().split(' '))

def find_pseudo_p(p):
	p = tuple(p)
	assert len(p) >= 2
	return tuple(reversed(p))
main()


from collections import *
import sys

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	n = ri()
	pp = rl()
	ans = pp[::-1]
	print(*ans)


a = int(input())
i = 0
while i < a:
	b = int(input())
	g = ''
	c = input().split(' ')
	p = b - 1
	d = []
	while p > -1:
		d.append(int(c[p]))
		p = p - 1
	p = 0
	while p < b:
		g = g + str(d[p])
		g = g + ' '
		p = p + 1
	print(g)
	i = i + 1


from bisect import *
from collections import *
from decimal import *

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

def st():
	return input().rstrip('\n')

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

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	n = inp()
	a = lis()
	b = a[-1::-1]
	print(*b)


import sys, bisect
from sys import stdin, stdout
from bisect import bisect_left, bisect_right, bisect, insort, insort_left, insort_right
from math import gcd, ceil, floor, sqrt

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def pr(n):
	stdout.write(str(n) + '\n')

def solve():
	n = inp()
	l = li()
	print(*l[::-1])
for _ in range(inp()):
	solve()


t = int(input())
for T in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = l[::-1]
	for j in a:
		print(j, end=' ')
	print()


t = int(input())
while t > 0:
	t -= 1
	n = input()
	permutation = input().strip().split(' ')
	print(' '.join(reversed(permutation)))


def Test():
	t = int(input())
	while t > 0:
		t -= 1
		soln()

def soln():
	n = int(input())
	a = list(map(int, input().strip().split(' ')))
	for i in range(n):
		if i == n - 1:
			print(a[n - i - 1])
		else:
			print(a[n - i - 1], end=' ')
Test()


def gt():
	return list(map(int, input().split()))
(t,) = gt()
while t:
	t -= 1
	(n,) = gt()
	ar = gt()
	print(*ar[::-1])


def func():
	t = int(input())
	for _ in range(t):
		_ = int(input())
		lst = input().strip().split()
		print(' '.join(lst[::-1]))
func()


import sys, math
try:
	(sys.stdin, sys.stdout) = (open('input.txt', 'r'), open('out.txt', 'w'))
except:
	pass
from sys import stdin, stdout
mod = int(1000000000.0 + 7)
from statistics import mode
from collections import *
from math import ceil, floor, inf, factorial, gcd, log2, sqrt, log
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()

def lcm(a, b):
	return a * b // gcd(a, b)

def setbits(n):
	return bin(n).count('1')

def resetbits(n):
	return bin(n).count('0')

def modinv(n, p):
	return pow(n, p - 2, p)

def ncr(n, r):
	(num, den) = (1, 1)
	r = min(n, n - r)
	for i in range(r):
		num *= n - i
		den *= i + 1
	return num // den

def ncr_p(n, r, p):
	(num, den) = (1, 1)
	r = min(r, n - r)
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * modinv(den, p) % p

def isPrime(num):
	if num <= 1:
		return False
	if num == 2 or n == 3:
		return True
	if num % 2 == 0 or num % 3 == 0:
		return False
	m = int(num ** 0.5) + 1
	for i in range(5, m, 6):
		if num % i == 0 or num % (i + 2) == 0:
			return False
	return True

def bin_search(s, low, high, val):
	while low <= high:
		mid = low + (high - low) // 2
		if s[mid] == val:
			return mid
		elif s[mid] < val:
			low = mid + 1
		else:
			high = mid - 1
	return -1

def sumofdigit(num):
	count = 0
	while num:
		count += num % 10
		num //= 10
	return count

def inputmatrix():
	(r, c) = iia()
	mat = [0] * r
	for i in range(r):
		mat[i] = iia()
	return (r, c, mat)

def prefix_sum(n, s):
	for i in range(1, n):
		s[i] += s[i - 1]
	return s

def binomial(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0

def divisors(n):
	res = []
	for i in range(1, ceil(sqrt(n)) + 1):
		if n % i == 0:
			if i == n // i:
				res.append(i)
			else:
				res.append(i)
				res.append(n // i)
	return res
for _ in range(ii1()):
	n = ii1()
	arr = iia()
	arr = arr[::-1]
	print(*arr)


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
for t in [wtf[i:i + 2] for i in range(1, len(wtf), 2)]:
	n = int(t[0])
	P = list(map(int, t[1].split()))
	print(' '.join(map(str, P[::-1])))


import sys
read = sys.stdin.read
readlines = sys.stdin.readlines

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		p = list(map(int, input().split()))
		r = p[::-1]
		print(*r, sep=' ')
main()


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}
	x = 2
	while x * x <= n:
		if n % x == 0:
			res.add(x)
			res.add(n // x)
		x += 1
	return res
for _ in range(int(input())):
	input()
	ar = reversed(list(map(int, input().split())))
	res = ' '.join((str(i) for i in ar))
	print(res)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.reverse()
	print(*l)


for i in range(int(input())):
	n = int(input())
	s = input().split()
	for i in s[::-1]:
		print(i, end=' ')


t = int(input())
while t:
	n = int(input())
	nl = list(map(int, input().split()))
	nl.reverse()
	print(*nl, sep=' ')
	t -= 1


T = int(input())
for t in range(T):
	n = int(input())
	st = input().split()
	p = []
	for i in range(n):
		p.append(int(st[i]))
	for i in range(n - 1, -1, -1):
		print(p[i], end=' ')
	print()


for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	p.reverse()
	print(' '.join((str(num) for num in p)))


import time, math
from sys import stdin, stdout

def I():
	return int(stdin.readline())

def In():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def Si():
	return sorted(list(map(int, stdin.readline().split())))

def Si():
	return sorted(list(map(int, stdin.readline().split())), reverse=True)

def P(x):
	return stdout.write(str(x) + ' ')

def P1(x):
	return stdout.write(str(x))

def Pi(x, y):
	return stdout.write(str(x) + ' ' + str(y))

def solve():
	for i in range(I()):
		n = I()
		l = L()
		for i in range(n - 1, -1, -1):
			P(l[i])
		P1('\n')
solve()


from math import gcd, ceil, log
from collections import Counter, deque
from heapq import heappush, heappop, heapify

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

def arp(arr):
	return ' '.join([str(i) for i in arr])
for _ in range(int(input())):
	(n,) = rl()
	arr = rl()
	ans = arr[::-1]
	print(arp(ans))


for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if n % 2 == 0:
		arr_res = list(reversed(arr))
	else:
		arr_res = list(reversed(arr))
	print(*arr_res)


testcases = int(input())
while testcases:
	string = ''
	size = int(input())
	array = list(map(int, input().split()))
	for i in reversed(array):
		string += str(i) + ' '
	print(string)
	testcases -= 1


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict, Counter
from os import path
import bisect as bi
import heapq

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

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

	def minp():
		return map(int, input().split())
else:

	def inp():
		return int(stdin.readline())

	def minp():
		return map(int, stdin.readline().split())
for _ in range(inp()):
	n = inp()
	a = list(minp())
	a.reverse()
	print(*a)


import sys
import math
mod = 998244353
cases = True
dynamic_factorial = False

def main(test_case=False):
	n = int(input()) if test_case else 1
	for _ in range(n):
		test()

def fast_pow(a: int, b: int):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
		a *= a
		b >>= 1
	return res

def c2(n):
	return n * (n - 1) // 2

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

def bits(n: int):
	return list(bin(n)).count('1')

def flush():
	sys.stdout.flush()

def parr(arr):
	print(*arr, sep=' ')

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

def ext_gcd(a: int, b: int):
	if b == 0:
		return [a, [1, 0]]
	res = ext_gcd(b, a % b)
	g = res[0]
	if g != 1:
		return False
	x1 = res[1][0]
	y1 = res[1][1]
	x = y1
	y = x1 - y1 * (a // b)
	return [g, [x, y]]

def get_set(a):
	res = {}
	for x in a:
		if x in res:
			res[x] += 1
		else:
			res[x] = 1
	return res
fact = {0: 1}

def factorial(n):
	if dynamic_factorial:
		if n not in fact:
			fact[n] = factorial(n - 1) * n
		return fact[n]
	else:
		res = 1
		while n > 0:
			res = res * n % mod
			n -= 1
		return res

def sum_of(a):
	res = 0
	for x in a:
		res = (res + x) % mod
	return res

def prod_of(a):
	res = 1
	for x in a:
		res = res * x % mod
	return res

def test():
	n = int(input())
	p = get()
	p.reverse()
	parr(p)
main(cases)


import sys
sys.setrecursionlimit(10000)
t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	p.reverse()
	print(*p)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	res = list(reversed(a))
	for j in res:
		print(j, end=' ')


for _ in range(int(input())):
	n = int(input())
	p = [int(x) for x in input().split()]
	p.reverse()
	print(' '.join((repr(y) for y in p)))


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ' '.join((str(i) for i in l))
	return ans
t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, sys.stdin.readline().split(' ')))
	x = a[::-1]
	print(nospace(x))
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(*list(reversed(arr)))


from sys import stdin, stdout
input = stdin.readline
print = lambda x: stdout.write(str(x) + '\n')
for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	ans = ' '.join(list(map(str, p[::-1])))
	print(ans)


def solve(n, p):
	ans = []
	for i in range(n - 1, -1, -1):
		ans.append(p[i])
	print(' '.join(map(str, ans)))
t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	solve(n, p)


t = int(input())
for _ in range(t):
	n = int(input())
	s = [int(i) for i in input().split()]
	for i in range(n - 1, 0, -1):
		print(s[i], end=' ')
	print(s[0])


TC = int(input())
for tc in range(TC):
	N = int(input())
	A = list(map(int, input().split()))
	for i in range(N):
		print(A[N - 1 - i], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	p.reverse()
	pp = ''.join((str(p[i]) + ' ' for i in range(n - 1))) + str(p[n - 1])
	print(pp)


T = int(input())
for case in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		print(a[i], end=' ')
	print()


n = int(input())
for i in range(n):
	m = int(input())
	list1 = list(map(int, input().split()))
	list1.reverse()
	print(' '.join((str(i) for i in list1)))


import sys
import math

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

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

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	n = int(input())
	a = get_array()
	print(*a[::-1])


from sys import stdin
from math import ceil
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	n = int(inp())
	a = [int(x) for x in inp().split()]
	a.reverse()
	print(*a)


n = int(input())
q = []
for i in range(n):
	a = int(input())
	b = list(map(int, input().split()))
	q.append(reversed(b))
for i in range(len(q)):
	print(*q[i])


t = int(input())
while t:
	n = int(input())
	v = list(map(int, input().split()))
	v.reverse()
	for i in v:
		print(i, end=' ')
	print()
	t -= 1


import sys
input = sys.stdin.readline

def prog():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		print(*a[::-1])
prog()


import sys
t = int(input())
while t > 0:
	t -= 1
	n = int(sys.stdin.readline())
	input = sys.stdin.readline()
	arr = list(map(int, input.split()))
	arr.reverse()
	print(*arr)


from sys import stdin
N = int(stdin.readline())
for case in range(N):
	length = int(stdin.readline())
	array = [int(i) for i in stdin.readline().split()]
	for i in range(length - 1, -1, -1):
		print(array[i], end=' ')
	print('\n')


t = int(input())
for _ in range(t):
	__ = input()
	lis = list(map(int, input().split()))
	print(*list(reversed(lis)), sep=' ')


n = int(input())
for i in range(n):
	l = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == l and max(a) == l:
		a.reverse()
		print(*a)


for i in range(int(input())):
	n = int(input())
	p = [int(j) for j in input().split()]
	print(' '.join((str(j) for j in p[::-1])))


for _ in [0] * int(input()):
	(n, a) = (int(input()), list(map(int, input().split())))
	print(*a[::-1])


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = 10 ** 9 + 7

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = defaultdict(int)
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors[i] += 1
			n //= i
		i += 1
	if n > 1:
		factors[n] += 1
	return factors

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

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

def main():
	n = int(input())
	arr = array()
	print(*arr[::-1])
t = 1
t = int(input())
for _ in range(t):
	main()


for j in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	print(*b[::-1])


T = int(input())
while T != 0:
	n = int(input())
	v = []
	for i in input().split():
		v.append(int(i))
	v.reverse()
	for i in v:
		print(i, end=' ')
	T = T - 1


t = int(input())
for _ in range(t):
	n = int(input())
	array = list(map(int, input().split()))
	array.reverse()
	print(*array)


import math

def solve(n, p):
	p = p[::-1]
	return ' '.join([str(p[i]) for i in range(n)])
t = int(input())
for t in range(t):
	n = int(input())
	p = [int(s) for s in input().split()]
	result = solve(n, p)
	print(result)


t = int(input())
while t > 0:
	n = int(input())
	li = input().split(' ')
	li.reverse()
	print(' '.join(li))
	t -= 1


rr = lambda : input().strip()
rrm = lambda : map(int, rr().split())

def solve():
	n = int(rr())
	p = list(rrm())
	p1 = p[::-1]
	return p1
T = int(rr())
for _ in range(T):
	ans = solve()
	print(*ans)


t = int(input())
for test_cases in range(t):
	n = int(input())
	st = [i for i in input().split(' ')]
	final_string = ''
	for i in range(n):
		final_string = final_string + st[n - 1 - i] + ' '
	print(final_string[:-1])


testcase = int(input())
for i in range(testcase):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr.reverse()
	for i in range(len(arr)):
		print(arr[i], end=' ')
	print('')


for i in range(int(input())):
	int(input())
	print(' '.join(map(str, reversed(list(map(int, input().split()))))))


for case in range(int(input())):
	N = int(input())
	arr = list(map(int, input().split()))
	arr = (i for i in arr[::-1])
	for elem in arr:
		print(elem, end=' ')


import sys
IN = sys.stdin.readline
out = []
for _ in range(int(IN())):
	n = int(IN())
	data = str()
	d = [x for x in map(int, IN().split())]
	for i in range(len(d) - 1, -1, -1):
		data += ' ' + str(d[i])
	out.append(data)
print('\n'.join(out))


t = int(input())
for i in range(t):
	input()
	print(' '.join(input().split()[::-1]))


t = int(input())
for i in range(t):
	n = int(input())
	s = input().split()
	if len(s) == n:
		print(*s[::-1])


def main(args):
	t = int(input())
	for i in range(t):
		n = int(input())
		m = list(input().split())
		m.reverse()
		print(' '.join(m))
import sys
sys.exit(main(sys.argv))


t = int(input())
results = []
for _ in range(t):
	n = int(input())
	a = input().split(' ')
	results.append(a[::-1])
for a in results:
	print(' '.join(a))


def Reverse(lst):
	lst.reverse()
	return lst
for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr = Reverse(arr)
	print(*arr)


for t in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.reverse()
	print(*l, sep=' ')


import sys
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	n = int(input())
	a = [int(i) for i in input().split()]
	a = a[::-1]
	a = [str(i) for i in a]
	print(' '.join(a))

def main():
	tc = int(input().strip())
	for case in range(tc):
		solve()
main()


t = int(input())
q = 0
while q < t:
	n = int(input())
	a = list(map(int, input().split()))
	a = a[::-1]
	for x in a:
		print(x, end=' ')
	print()
	q += 1


import math
import sys
from sys import *
import heapq
from collections import deque, defaultdict
from itertools import permutations, combinations, combinations_with_replacement
import random
import os
mod = 10 ** 9 + 7
MAX = sys.maxsize
MIN = -sys.maxsize - 1

def isPrime(n):
	if n > 1:
		for i in range(2, n):
			if n % i == 0:
				return False
		else:
			return True
	else:
		return False

def isPanagram(s):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	for char in alphabet:
		if char not in s.lower():
			return False
	return True

def diff(list1):
	res = [list1[i + 1] - list1[i] for i in range(len(list1) - 1)]
	return res

def isEqual(list1):
	if len(list1) < 0:
		res = True
	res = all((ele == list1[0] for ele in list1))
	if res:
		return True
	else:
		return False

def checkPali(s):
	ar = [0] * 256
	for i in range(len(s)):
		ar[ord(s[i])] = ar[ord(s[i])] + 1
	odd = 0
	for i in range(256):
		if ar[i] & 1:
			odd += 1
		if odd > 1:
			return False
	return True

def remove_duplicate(list1):
	final_list = list(set(list1))
	return final_list

def solve():
	n = int(input())
	l = list(map(int, input().split()))
	if len(l) == 2:
		x = l[::-1]
	else:
		x = l[::-1]
	return ' '.join(map(str, x))
t = int(stdin.readline().strip())
for i in range(t):
	result = solve()
	stdout.write(str(result) + '\n')


for _ in range(int(input())):
	n = int(input())
	al = list(map(int, input().split()))
	ans = al[::-1]
	print(*ans)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().strip().split()[:n]))
	k1 = l[n // 2 + 1:]
	k2 = l[:n // 2]
	k1 = k1[::-1]
	k2 = k2[::-1]
	z = k1 + [l[n // 2]] + k2
	print(*z)


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().strip(' ').split(' ')))
	print(' '.join((str(i) for i in p[::-1])))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [*map(int, input().split())]
	print(' '.join(map(str, reversed(arr))))


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a = a[::-1]
	print(*a)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	data = [d for d in sys.stdin.readline().split()]
	print(' '.join(data[::-1]))


def main():
	t = int(input())
	sol = []
	for i in range(t):
		n = int(input())
		arr = [int(x) for x in input().split()]
		currSol = []
		if n == 2:
			currSol.append(arr[1])
			currSol.append(arr[0])
		elif n == 3:
			currSol.append(arr[2])
			currSol.append(arr[1])
			currSol.append(arr[0])
		else:
			for j in range(len(arr) - 1, -1, -1):
				currSol.append(arr[j])
		sol.append(currSol)
	for i in range(t):
		for j in range(len(sol[i])):
			print(sol[i][j], end=' ')
		print()
main()


t = int(input())

def main():
	n = int(input())
	p = list(map(int, input().split()))
	q = p[::-1]
	s = ' '.join((str(c) for c in q))
	print(s)
for i in range(t):
	main()


import math
from decimal import *
import random
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	for i in range(n - 1, -1, -1):
		ans.append(str(arr[i]))
	print(' '.join(ans))


import sys, math
for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	print(*p[::-1])


def main():
	n = int(input())
	p = list(map(int, input().split()))
	p = list(reversed(p))
	for i in p:
		print(i, end=' ')
	print()

def __starting_point():
	t = int(input())
	for i in range(t):
		main()
__starting_point()


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

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

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(*l[::-1])


from math import ceil, floor, log, sqrt, factorial
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l.reverse()
	print(*l)


for t in range(int(input())):
	n = int(input())
	F = [int(i) for i in input().split()]
	for i in range(len(F)):
		print(F[n - (i + 1)], end=' ')
	print()


from math import *
from collections import *
from itertools import *
from functools import *
from bisect import *
from heapq import *
from operator import *
from sys import *
setrecursionlimit(100000000)
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(*l[::-1])


import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi

def input():
	return sys.stdin.readline()[:-1]
import string
from bisect import bisect_left, bisect_right
from functools import lru_cache
MOD = int(1000000000.0) + 7
INF = float('inf')

def solve():
	n = int(input())
	p = [int(x) for x in input().split()]
	p.reverse()
	print(*p)
t = 1
t = int(input())
for case in range(1, t + 1):
	ans = solve()


def main():
	n = int(input())
	arr = input().split(' ')
	arr.reverse()
	print(' '.join(arr))
t = int(input())
for _ in range(t):
	main()


t = int(input())
while t != 0:
	n = int(input())
	list1 = list(map(int, input().split()))
	list1 = list1[::-1]
	print(*list1)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	print(' '.join(map(str, x[::-1])))


import sys
input = sys.stdin.readline

def inInt():
	return int(input())

def inStr():
	return input().strip('\n')

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

def inSList():
	return input().split()

def bsearch(nums, target):
	N = len(nums or [])
	l = 0
	r = N - 1
	while l <= r:
		mid = (l + r) // 2
		if nums[mid] < target:
			l = mid + 1
		elif nums[mid] > target:
			r = mid - 1
		else:
			return (None, mid, None)
	return (r if r >= 0 else None, None, l if l <= N - 1 else None)

def yesOrNo(val):
	print('YES' if val else 'NO')

def printSpacedArray(nums):
	for x in nums:
		print(x, end=' ')
	print()

def solve():
	n = inInt()
	case = inIList()
	case.reverse()
	printSpacedArray(case)
tests = inInt()
for case in range(tests):
	solve()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	input()
	data = input().split()
	print(' '.join(data[::-1]))


t = int(input())
while t:
	n = int(input())
	given_list = list(map(int, input().split()))
	shuffle_list = given_list[::-1]
	for num in shuffle_list:
		print(num, end=' ')
	t = t - 1


def differentPerm(perm1):
	perm1.reverse()
	return perm1

def displayArray(arr1):
	string = ''
	for i in arr1:
		string = string + str(i) + ' '
	return string
queryNum = int(input())
for i in range(queryNum):
	length = int(input())
	c = list(map(int, input().split()))
	print(displayArray(differentPerm(c)))


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		values = list(map(int, input().split()))
		for i in range(n - 1, -1, -1):
			print(values[i], end=' ')
		print()
main()


import math as mt
import collections as cc
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	(n,) = I()
	l = I()
	print(*l[::-1])


import math
t = int(input())
while t:
	n = int(input())
	t -= 1
	x = list(map(int, input().split()))
	print(*x[::-1])


t = int(input())
for i in range(t):
	n = int(input())
	myinput = input()
	myinput = myinput.split()
	mystr = ''
	for j in range(n - 1, -1, -1):
		mystr += str(myinput[j])
		mystr += ' '
	print(mystr)


import sys, collections, math

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

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

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	n = int(input())
	arr = get_array()
	for i in range(n - 1, -1, -1):
		print(arr[i], end=' ')
	print()


import random

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

def lcm(a, b):
	return a * b / gcd(a, b)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	for i in range(n - 1, -1, -1):
		print(a[i], end=' ')
	print('')


t = int(input())
for test in range(t):
	n = int(input())
	arr1 = [int(i) for i in input().split(' ')]
	list1 = [arr1[n - 1 - i] for i in range(n)]
	res_str = str(list1[0])
	for i in range(n - 1):
		res_str = res_str + ' ' + str(list1[i + 1])
	print(res_str)


def op():
	n = int(input())
	arr = list(map(int, input().split()))
	arr_rev = [0] * n
	for i in range(n):
		c = arr[i]
		arr_rev[n - i - 1] = c
	for i in range(n):
		print(arr_rev[i], '', end='')
t = int(input())
while t > 0:
	t = t - 1
	op()
	print()


import sys
readline = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(readline())

def read_int_n():
	return list(map(int, readline().split()))

def read_float():
	return float(readline())

def read_float_n():
	return list(map(float, readline().split()))

def read_str():
	return readline().strip()

def read_str_n():
	return readline().strip().split()

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.perf_counter()
		ret = f(*args, **kwargs)
		e = time.perf_counter()
		error_print(e - s, 'sec')
		return ret
	return wrap

def f(a):
	s = []
	for i in range(len(a) - 1):
		s.append(a[i] + a[i + 1])
	s.sort()
	return s

@mt
def slv(N, A):
	A.reverse()
	return A

def main():
	for _ in range(read_int()):
		N = read_int()
		A = read_int_n()
		print(*slv(N, A))
main()


t = int(input())
for i in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	br = ar[::-1]
	for j in range(n):
		br[j] = str(br[j])
	print(' '.join(br))


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	print(*reversed(l))


t = int(input())
for i in range(t):
	n = int(input())
	ans = list(reversed(list(map(int, input().split()))))
	for k in ans:
		print(k, end=' ')
	print()


T = int(input())
for t in range(T):
	N = int(input())
	L = list(map(int, input().split()))
	for i in L[::-1]:
		print(i, end=' ')
	print()


from sys import stdin, stdout
q = int(input())
for i in range(q):
	n = int(input())
	p = list(map(int, stdin.readline().split()))
	for i in p[::-1]:
		print(i, end=' ')
	print()


import sys
import math
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()
for T in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	for i in a[::-1]:
		print(i, end=' ')
	print()


test = int(input())
while test > 0:
	test = test - 1
	n = int(input())
	li = list(map(int, input().split()))
	li.reverse()
	print(*li, sep=' ')


for _ in range(int(input())):
	input()
	arr = list(map(int, input().split()))
	print(*arr[::-1])


import sys

def main():
	t = Iint()
	for _ in range(t):
		n = Iint()
		p = Ilist()
		Plist(p[::-1])
en = enumerate

def debug(*args, c=6):
	pass
	print('\x1b[3{}m'.format(c), *args, '\x1b[0m', file=sys.stderr)
FIO = 10
BUFSIZE = 8 * 1024

def Istr():
	return input()

def Iint():
	return int(input())

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

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

def Plist(li, s=' '):
	print(s.join(map(str, li)))
if not FIO:
	if __name__ == '__main__':
		main()
		exit()
else:
	from io import BytesIO, IOBase
	import os

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


import sys
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.141592653589793

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

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

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

def read_ints2(x):
	return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())

def read_str_list():
	return list(sys.stdin.readline().strip().split())

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

def GCD(a: int, b: int) -> int:
	return b if a % b == 0 else GCD(b, a % b)

def LCM(a: int, b: int) -> int:
	return a * b // GCD(a, b)

def Main():
	for _ in range(read_int()):
		n = read_int()
		p = read_int_list()
		print(*p[::-1])
Main()


t = int(input())
while t:
	t -= 1
	n = int(input())
	p = [int(pi) for pi in input().split()]
	p = p[::-1]
	for pi in p:
		print(pi, end=' ')
	print()


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l2 = l[::-1]
	print(*l2)


import sys

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

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
	N = INT()
	P = LIST()
	ans = P[::-1]
	print(*ans)


def program():
	n = int(input())
	arr = list(map(int, input().split()))
	arr.reverse()
	for x in arr:
		print(x, end=' ')
	print()
for i in range(int(input())):
	program()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = reversed(a)
	b = list(map(str, b))
	print(' '.join(b))


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	k = []
	for i in range(n - 1, -1, -1):
		k.append(arr[i])
	for i in range(0, n - 1):
		print(k[i], end=' ')
	print(k[n - 1])


import sys
import math
for _ in range(int(input())):
	n = int(input())
	a = [int(o) for o in input().split()]
	print(*a[::-1])


t = int(input())
for _ in range(t):
	n = int(input())
	nums = list(map(int, input().split()))
	for i in range(n // 2):
		num1 = nums[i]
		num2 = nums[~i]
		nums[i] = num2
		nums[~i] = num1
	print(*nums)


import sys, math, collections
from collections import defaultdict

def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w')

def get_array():
	l = list(map(int, input().split()))
	return l

def get_2_ints():
	(a, b) = map(int, input().split())
	return (a, b)

def get_3_ints():
	(a, b, c) = map(int, input().split())
	return (a, b, c)

def sod(n):
	(n, c) = (str(n), 0)
	for i in n:
		c += int(i)
	return c

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def getFloor(A, x):
	(left, right) = (0, len(A) - 1)
	floor = -1
	while left <= right:
		mid = (left + right) // 2
		if A[mid] == x:
			return A[mid]
		elif x < A[mid]:
			right = mid - 1
		else:
			floor = A[mid]
			left = mid + 1
	return floor

def chk(l, n):
	s = 0
	o = 0
	for i in range(len(l)):
		s += l[i]
		if s > n:
			return 0
		if s == n:
			ind = i
			o = 1
			break
	if o:
		return sum(l[ind + 1:]) == n

def main():
	for tt in range(int(input())):
		n = int(input())
		l = get_array()
		l.reverse()
		print(*l)
main()


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())
t = inp()
res = []
for i in range(t):
	n = inp()
	l = inlt()
	l.reverse()
	print(' '.join([str(x) for x in l]))


n = int(input())
for i in range(n):
	m = int(input())
	arr = list(map(int, input().split()))[:m]
	arr = arr[::-1]
	print(*arr, sep=' ')


for _ in range(int(input())):
	input()
	print(' '.join(input().split()[::-1]))


for _ in range(int(input())):
	a = int(input())
	b = [int(i) for i in input().split()]
	b.reverse()
	for i in range(a):
		print(b[i], end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	while n > 0:
		print(p[n - 1], end=' ')
		n -= 1
	print('')


import sys
inp = sys.stdin.readline
out = sys.stdin.write

def minp(x):
	return map(int, x.split())

def linp(x):
	return list(minp(x))

def main():
	for _ in range(int(inp())):
		n = int(inp())
		p = linp(inp())
		p = reversed(p)
		print(*p)
main()


def iinput():
	return [int(i) for i in input().split()]
t = int(input())
for i in range(t):
	n = int(input())
	p = iinput()
	p1 = p[::-1]
	print(*p1)


def run_case():
	n = int(input())
	nums = list(map(int, input().split()))
	nums.reverse()
	print(' '.join((str(i) for i in nums)))
flag = 1
if flag:
	t = int(input())
	for i in range(t):
		run_case()
else:
	run_case()


T = int(input())
for _ in range(0, T):
	n = int(input())
	s = [int(x) for x in input().split()]
	s = s[::-1]
	print(*s)


t = int(input())
for i in range(t):
	input()
	print(*reversed(input().strip().split()))


jj = int(input())
for ll in range(jj):
	pp = int(input())
	a = list(map(int, input().split()))[::-1]
	for i in a:
		print(i, end=' ')
	print()


TC = int(input())
for ti in range(TC):
	n = int(input())
	l = list(map(int, input().split()))
	print(' '.join(map(str, l[::-1])))


for _ in range(int(input())):
	i_liczb = int(input())
	liczby = list(map(int, input().split()))
	print(*liczby[::-1])


a = int(input())
i = 0
while i < a:
	z = input()
	arr = input().split(' ')
	i += 1
	print(' '.join(arr[::-1]))


for i in range(int(input())):
	input()
	print(*[int(i) for i in input().split()][::-1])


t = int(input())
while t:
	a = int(input())
	arr = [int(x) for x in input().split()]
	arr.reverse()
	for i in arr:
		print(i, end=' ')
	print()
	t -= 1


for i in range(int(input())):
	a = int(input())
	s = [int(i) for i in input().split()]
	print(*s[::-1])


n = int(input())
for i in range(n):
	length = int(input())
	s = input().split(' ')
	L = [0] * length
	LL = [0] * length
	for j in range(length):
		L[j] = int(s[j])
	for j in range(length):
		LL[j] = L[length - 1 - j]
	ss = ''
	for j in range(length):
		ss += str(LL[j])
		ss += ' '
	print(ss[:-1])


for _ in range(int(input())):
	n = int(input())
	data = [int(x) for x in input().split()]
	for q in data[::-1]:
		print(q, end=' ')
	print()


from bisect import bisect_left
import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict
from collections import deque
from functools import cmp_to_key
import math
import heapq

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		n = iin()
		l = ain()
		l = l[::-1]
		print(*l)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdout, stdin
from collections import defaultdict, deque
import math
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	l = list(map(int, stdin.readline().split()))
	print(*l[::-1])


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	for i in range(n):
		print(a[n - i - 1], end=' ')
	print('')


for i in range(int(input())):
	n = int(input())
	x = list(map(int, input().strip().split()))
	for j in range(n - 1, -1, -1):
		print(x[j], end=' ')


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		arr = [int(p) for p in input().split()]
		print(*arr[::-1])
main()


try:
	t = int(input())
	while t != 0:
		n = int(input())
		arr = list(map(int, input().split()))
		arr.reverse()
		print(*arr)
		t = t - 1
except EOFError:
	print(' ')


import os, sys
from io import IOBase, BytesIO
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def get_input(a=str):
	return a(input())

def get_int_input():
	return get_input(int)

def get_input_arr(a):
	return list(map(a, input().split()))

def get_int_input_arr():
	return get_input_arr(int)

def solve():
	t = get_int_input()
	for _ in range(t):
		n = get_int_input()
		arr = get_int_input_arr()
		cout << ' '.join(map(str, arr[::-1])) << endl

def main():
	solve()
main()


t = int(input())
for i in range(t):
	n = int(input())
	list1 = list(map(str, input().split()))
	list2 = list1[-1::-1]
	print(' '.join(list2))


tests = int(input())
for t in range(tests):
	arrayLen = int(input())
	array = input().split()
	reversedArray = array[::-1]
	print(*reversedArray)


cases = int(input())
res = []
for i in range(cases):
	n = int(input())
	p = []
	for x in input().split(' '):
		p.append(int(x))
	q = list(p)
	for i in range(n // 2):
		q[i] = p[len(p) - 1 - i]
		q[len(p) - 1 - i] = p[i]
	res.append(q)
for el in res:
	print(*el, sep=' ')


def main():
	t = int(input())
	for __ in range(t):
		n = int(input())
		p = list(map(int, input().split()))
		print(*p[-1::-1])
main()


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	l.reverse()
	ans.append(l)
for k in ans:
	for a in k:
		print(a, end=' ')
	print()


t = int(input())
for j in range(0, t):
	n = int(input())
	x = [int(i) for i in input().split()]
	l = x[::-1]
	print(*l, sep=' ')


import math
import os
import random
import re
import sys
from collections import defaultdict, Counter, deque
import heapq
from functools import lru_cache
from itertools import accumulate, chain, combinations, permutations, groupby, zip_longest
from math import floor, ceil, sqrt

def finger(p):
	return p[::-1]
t = int(input())
res = []
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	res += (finger(p),)
for perm in res:
	print(' '.join(map(str, perm)))


t = int(input())
while t > 0:
	s = ''
	a = int(input())
	l = list(map(int, input().split()))
	l.reverse()
	for i in range(0, len(l), 1):
		s += str(l[i])
		s += ' '
	print(s[0:len(s) - 1])
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	li = list(input().split())
	li.reverse()
	print(' '.join(li))


for T in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	nl = l[::-1]
	for i in range(len(nl)):
		print(nl[i], end=' ')


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	a = input().split()
	for i in range(0, n):
		a[i] = int(a[i])
	for i in range(n - 1, -1, -1):
		print(a[i], end=' ')
	print()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = [int(x) for x in input().split()]
	ans = arr[::-1]
	for a in ans:
		print(a, end=' ')
	print()


t = int(input())
for case in range(t):
	n = int(input())
	List = [int(j) for j in input().split(' ')]
	List.reverse()
	for k in range(n - 1):
		print(List[k], end=' ')
	print(List[n - 1])


t = int(input())
for r in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l.reverse()
	for i in l:
		print(i, end=' ')
	print()


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

def main():

	def solve():
		n = int(input())
		print(' '.join(reversed(input().split())))
	t = int(input())
	for i in range(t):
		solve()
BUFFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
input = lambda : sys.stdin.readline().rstrip('\r\n')

def print(*args, **kwargs):
	sep = kwargs.pop('sep', ' ')
	file = kwargs.pop('file', sys.stdout)
	atStart = True
	for x in args:
		if not atStart:
			file.write(sep)
		file.write(str(x))
		atStart = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
main()


testc = int(input())
for ion in range(testc):
	l = int(input())
	p = input().split()
	for po in range(l):
		p[po] = int(p[po])
	x = []
	x = p[::-1]
	for ope in range(l):
		lo = x[ope]
		print(lo, end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	yo = list(reversed(l))
	for j in yo:
		print(j, end=' ')
	print()


def solve():
	n = int(input())
	p = [int(x) for x in input().split()]
	p.reverse()
	return ' '.join((str(x) for x in p))
T = int(input())
for case in range(T):
	print(solve())


for i in range(int(input())):
	n = int(input())
	print(' '.join(list(reversed(input().split()))))


def inp_n():
	return int(input())

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

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

def is_odd(n):
	if n & 1:
		return True
	return False

def is_prime(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
from collections import defaultdict
import math
for _ in range(inp_n()):
	n = inp_n()
	l = inp_list()
	l.reverse()
	print(*l)


for _ in range(int(input())):
	length = int(input())
	permutation = [int(x) for x in input().split()]
	permutation.reverse()
	print(*permutation)


t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	p.reverse()
	for pp in p:
		print(pp, end=' ')
	print()


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

def solve(arr, n):
	return arr[::-1]
	pass
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	ans.append(solve(arr, n))
for test in ans:
	for ele in test:
		print(ele, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	for i in reversed(a):
		print(i, end=' ')
	print()


answers = list()
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	answers.append(reversed(l))
for answer in answers:
	s = ''
	for i in answer:
		s += str(i)
		s += ' '
	print(s)


def fingerPrint(p):
	s = []
	for i in range(len(p) - 1):
		s.append(p[i] + p[i + 1])
	s.sort()
	return s
t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))[:n]
	p1 = p[::-1]
	if fingerPrint(p) == fingerPrint(p1):
		print(*p1, sep=' ')


t = int(input())
while t > 0:
	n = int(input())
	x = [int(x) for x in input().split()]
	y = reversed(x)
	for item in y:
		print(item, end=' ')
	print('')
	t -= 1


t = int(input())
for j in range(t):
	n = int(input())
	f = list(map(int, input().split()))
	lis = []
	for i in reversed(f):
		lis.append(i)
	print(*lis)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a.reverse()
	for i in a:
		print(i)
	print('')


tcases = int(input())
for i in range(tcases):
	L = int(input())
	a = list(map(int, input().split()))
	a.reverse()
	print(*a)


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	n = int(z())
	print(*zzz()[::-1])
exit()
for _ in range(num):
	n = int(z())
	l = list(ac(zzz()))
	print(abs(min(l)))


def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		print(*a[::-1])
main()


def solve(a):
	a = a[::-1]
	return a
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(*solve(a))


for ctr in range(int(input())):
	input()
	print(*list(map(int, input().split()))[::-1])


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	n = int(I1())
	a = list(I())
	for i in range(n - 1, -1, -1):
		print(a[i], end=' ')
	print()


for _ in range(int(input())):
	a = map(int, input().split())
	l = [int(i) for i in input().split()]
	l.reverse()
	print(*l)


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, A):
	A = A[::-1]
	return ' '.join(map(str, A))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(N,) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, A)
	print(ans)


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


class Graph1:

	def __init__(self):
		self.g = {}

	def add_edge(self, a, b):
		if a in self.g:
			self.g[a].append(b)
		else:
			self.g[a] = [b]
		if b in self.g:
			self.g[b].append(a)
		else:
			self.g[b] = [a]

def dfs(g, root, da, visited, ap, distance):
	if distance % da == 0:
		ap[root] = distance // da
	visited.add(root)
	for i in g[root]:
		if i not in visited:
			visited.add(root)
			dfs(g, i, da, visited, ap, distance + 1)

def get_path(g, source, db, destination, visited):
	if source == destination:
		return [source]
	path = []
	visited.add(source)
	for i in g[source]:
		if i not in visited:
			visited.add(i)
			t = get_path(g, i, db, destination, visited)
			if t != []:
				path.append(source)
				path.extend(t)
	return path

def process():
	n = int(input())
	li = input().split()
	li.reverse()
	return ' '.join(li)
tests = int(input())
for i in range(tests):
	print(process())


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)
for xyz in range(0, int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(*l[::-1])


for i in range(int(input())):
	n = int(input())
	numbers = [int(j) for j in input().split()]
	numbers.reverse()
	print(*numbers)


import sys

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

def getInt():
	return int(input())

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

def getIntList():
	return list(getIntIter())
for _ in range(getInt()):
	input()
	l = input().split()
	l.reverse()
	print(' '.join(l))


import math

def c(d):
	return True
for _ in range(int(input())):
	n = int(int(input()))
	a = list(map(int, input().split()))
	c(1)
	if n % 2:
		m = n // 2
		l1 = list(reversed(a[:m]))
		l2 = list(reversed(a[m + 1:]))
		l2.append(a[m])
	else:
		m = n // 2
		l1 = list(reversed(a[:m]))
		l2 = list(reversed(a[m:]))
	ans = l2 + l1
	print(*ans)


import sys
from itertools import permutations
input = sys.stdin.readline

def solve():
	n = int(input())
	L = list(map(int, input().split()))
	print(*L[::-1])
for _ in range(int(input())):
	solve()


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	for i in range(n - 1, -1, -1):
		print('{} '.format(l[i]), end='')
	print()


n = int(input())
for i in range(n):
	no = int(input())
	l = list(map(int, input().split()))
	l.reverse()
	print(' '.join(map(str, l)))


for _ in range(int(input())):
	n = int(input())
	print(' '.join(list(reversed(input().split()))))


test_cases = int(input())
for test_case in range(test_cases):
	n = int(input())
	p = list(map(int, input().split()))
	p.reverse()
	print(*p)


n = int(input())
for i in range(n):
	y = int(input())
	arr = list(map(int, input().split()))
	print(' '.join((str(i) for i in arr[::-1])))


def solution(arr):
	new = arr[::-1]
	return new
for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	ans = solution(arr)
	print(*ans)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	a.reverse()
	for i in range(n):
		print(a[i], end=' ')
	print()
ct = int(input())
while ct > 0:
	solve()
	ct -= 1


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	ans = []
	for j in range(n):
		ans.append(p[n - j - 1])
	for k in ans:
		print(k, end=' ')
	print()


for _ in range(int(input())):
	input()
	i = list(map(int, input().split(' ')))
	i.reverse()
	print(' '.join(list(map(str, i))))


for _ in ' ' * int(input()):
	input()
	print(*input().split()[::-1])


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
t = int(input())
for k in range(t):
	n = int(input())
	a = list(map(int, input().split()))[:n]
	a.reverse()
	for i in a:
		print(i, end=' ')
	print()


t = int(input())
i = t
while i > 0:
	i = i - 1
	n = int(input())
	p = input().split()
	j = n - 1
	while j >= 0:
		print(p[j], end=' ')
		j = j - 1
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		print(arr[i], end=' ')
	print()


import sys
ii = lambda : sys.stdin.readline().strip()
idata = lambda : [int(x) for x in ii().split()]

def solve():
	n = int(ii())
	data = idata()
	print(*data[::-1])
	return
for t in range(int(ii())):
	solve()


for _ in range(int(input())):
	input()
	a = list(map(int, input().split()))
	a.reverse()
	print(*a)


for _ in range(int(input())):
	a = int(input())
	li = list(map(int, input().split()))
	print(*li[::-1])


from sys import stdin, stdout
get_string = lambda : stdin.readline().strip(' ')
get_intmap = lambda : map(int, get_string().split(' '))

def testcase():
	n = int(input())
	l = list(get_intmap())
	print(' '.join([str(i) for i in l[::-1]]))
for t in range(int(input())):
	testcase()


num_t = int(input())
answers = list()
for test in range(num_t):
	n = int(input())
	arr = input().split()
	arr = arr[::-1]
	st = ''
	for i in arr:
		st += i + ' '
	answers.append(st)
for i in answers:
	print(i)


from sys import stdin, stdout
from collections import defaultdict

def dfs(src):
	global ans
	vis[src] = 1
	ans += [src]
	for neigh in g[src]:
		if not vis[neigh]:
			dfs(neigh)
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	print(*a[::-1])


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	b = []
	while n - 1 >= 0:
		b.append(a[n - 1])
		n -= 1
	print(' '.join(map(str, b)))


t = int(input())
for _ in range(t):
	input()
	print(*list(reversed(input().split())))


import sys
from functools import reduce
from collections import Counter
import time
import datetime
from math import sqrt, gcd

def ip():
	return int(sys.stdin.readline())

def sip():
	return sys.stdin.readline()

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

def mips():
	return map(str, sys.stdin.readline().split())

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

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def minJumps(arr, n):
	jumps = [0 for i in range(n)]
	if n == 0 or arr[0] == 0:
		return float('inf')
	jumps[0] = 0
	for i in range(1, n):
		jumps[i] = float('inf')
		for j in range(i):
			if i <= j + arr[j] and jumps[j] != float('inf'):
				jumps[i] = min(jumps[i], jumps[j] + 1)
				break
	return jumps[n - 1]

def dic(arr):
	return Counter(arr)

def check_prime(n):
	if n < 2:
		return False
	for i in range(2, int(n ** 0.5) + 1, 2):
		if n % i == 0:
			return False
	return True
t = ip()
while t:
	t -= 1
	n = ip()
	arr = lip()
	print(*arr[::-1])


tt = int(input())
for _ in range(tt):
	n = int(input())
	a = input().split()
	a.reverse()
	print(' '.join(a))


for case in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	a = a[::-1]
	print(*a)


for _ in range(int(input())):
	n = int(input())
	arr = [int(num) for num in input().split(' ')]
	arr.reverse()
	for item in arr:
		print(item, end=' ')
	print('')


for q in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	li.reverse()
	print(*li)


import math
import sys
input = sys.stdin.readline

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

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

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

def invar():
	return map(int, input().split())
for _ in range(inp()):
	n = inp()
	a = list(map(int, input().split()))
	print(*a[::-1])


t = int(input())
for i in range(t):
	n = int(input())
	ar = [int(k) for k in input().split()]
	for k in ar[::-1]:
		print(k, end=' ')
	print('')


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
for _ in range(int(input())):
	q = int(input())
	w = list(map(int, input().split()))
	print(*w[::-1])


def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		a.reverse()
		print(' '.join([str(x) for x in a]))
main()


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


for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	if len(array) == 1:
		print(array[0])
	else:
		for i in range(n - 1, -1, -1):
			print(array[i], end=' ')
		print()


for i in range(int(input())):
	k = (input(), input())[1]
	print(' '.join(k.strip().split()[::-1]))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
from collections import Counter
from collections import defaultdict as dc
for _ in range(N()):
	n = N()
	a = RLL()
	print_list(a[::-1])


def solve():
	N = int(input())
	A = [int(s) for s in input().split()]
	A = A[::-1]
	print(*A)
	return
T = int(input())
for t in range(T):
	solve()


for _ in range(int(input())):
	input()
	p = list(map(int, input().split(' ')))
	p.reverse()
	print(*p)


testcases = int(input())
lis = []
for i in range(testcases):
	length = int(input())
	permutation = list(map(int, input().split(' ')))
	lis.append(permutation)
for i in lis:
	rev = i[::-1]
	for i in rev:
		print(i, end=' ')


import math
t = int(input(''))
for i in range(t):
	n = int(input(''))
	a = list(map(int, input('').split()))
	a.reverse()
	print(' '.join(map(str, a)))


from sys import stdin, stdout

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

def gms():
	return map(str, stdin.readline().strip().split())

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

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

def gs():
	return stdin.readline().strip()

def gls():
	return list(stdin.readline())

def gi():
	return int(stdin.readline())
t = gi()
while t:
	t -= 1
	n = gi()
	ar = gari()
	print(*ar[::-1])


from sys import stdin, stdout

def main():
	t = int(stdin.readline())
	for _ in range(t):
		n = int(stdin.readline())
		perm = [i for i in stdin.readline().split()]
		perm.reverse()
		stdout.write('{}\n'.format(' '.join(perm)))
main()


def tc():
	n = int(input())
	a = input().split()
	print(' '.join(reversed(a)))
T = int(input())
for _ in range(T):
	tc()


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(str, input().split()))
	print(' '.join(arr[::-1]))


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	for x in reversed(a):
		print(x, end=' ')
	print()


def getP(arr):
	ans = []
	for i in range(len(arr) - 1, -1, -1):
		ans.append(arr[i])
	return ans
T = int(input())
for t in range(T):
	N = input()
	arr = [int(i) for i in input().split(' ')]
	p = getP(arr)
	print(' '.join([str(i) for i in p]))


import sys
input = sys.stdin.readline
t = int(input())
for rrr in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(*arr[::-1])


n = int(input())
for i in range(n):
	m = int(input())
	a = [int(i) for i in input().split()]
	print(*a[::-1])


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	B = A[::-1]
	print(*B)


import sys
sysinput = sys.stdin.readline
import time
start_time = time.time()

def inp():
	return int(sysinput())

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

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

def invr():
	return map(int, sysinput().split())
t = inp()
while t > 0:
	t -= 1
	n = inp()
	p = inlt()
	for i in range(n // 2):
		(p[i], p[n - i - 1]) = (p[n - i - 1], p[i])
	for i in p:
		print(i)


for cnt in range(int(input())):
	n = int(input())
	P = list(map(int, input().split()))
	for p in range(n - 1, -1, -1):
		print(P[p], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	p = [int(i) for i in input().split()]
	print(*reversed(p))


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(s) for s in input().split(' ')]
	a.reverse()
	print(' '.join(map(str, a)))


N = int(input())
Ans = []
for i in range(N):
	A = int(input())
	B = list(map(int, input().split()))
	Ans.append(B[::-1])
for i in Ans:
	for j in i:
		print(j, end=' ')
	print()


def fingerprint(p):
	n = len(p)
	f = sorted([p[i] + p[i + 1] for i in range(n - 2)])
	return f
t = int(input())
for _ in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	print(*p[::-1])


def main():
	testCases = int(input())
	for i in range(testCases):
		el = int(input())
		out = ''
		numbers = input().split()
		for j in range(len(numbers)):
			out += numbers[len(numbers) - 1 - j]
			if j != len(numbers) - 1:
				out += ' '
		print(out)
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	e = ''
	for i in a[::-1]:
		e += str(i) + ' '
	print(e.strip())


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	stdin = lambda type_='int', sep=' ': list(map(eval(type_), input().split(sep)))
	t = int(input())
	import itertools
	import collections
	import random
	for _ in range(t):
		n = int(input())
		permu = stdin()
		for i in range(n // 2):
			(permu[i], permu[n - 1 - i]) = (permu[n - 1 - i], permu[i])
		print(*permu, sep=' ')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		l = list(In())
		if n & 1 == 1:
			a1 = l[0:n // 2]
			temp = l[n // 2]
			a2 = l[n // 2 + 1:n]
			a1.reverse()
			a2.reverse()
			a2 += a1
			a2.insert(n // 2, temp)
			print(*a2)
		else:
			a1 = l[0:n // 2]
			a2 = l[n // 2:n]
			a1.reverse()
			a2.reverse()
			a2 += a1
			print(*a2)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


import sys
input = sys.stdin.readline
INF = float('inf')
tc = int(input())
for _ in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	if n % 2 == 0:
		for i in range(n // 2):
			(arr[i], arr[-(i + 1)]) = (arr[-(i + 1)], arr[i])
	else:
		for i in range(n // 2):
			if i == n // 2:
				break
			(arr[i], arr[-(i + 1)]) = (arr[-(i + 1)], arr[i])
	for i in arr:
		print(i, end=' ')
	print()


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def string2intlist(s):
	return list(map(int, s))

def calculate_sum(a, N):
	m = N / a
	sum = m * (m + 1) / 2
	ans = a * sum
	return ans

def series(N):
	return N * (N + 1) // 2

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def LCM(x, y):
	return x * y // GCD(x, y)

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def isprime(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
for _ in range(inin()):
	n = inin()
	a = lin()
	print(*a[::-1])


t = int(input())
while t > 0:
	n = int(input())
	A = list(map(str, input().split(' ')))
	m = []
	for i in range(len(A)):
		m.append(str(A[i]))
	m.reverse()
	print(' '.join(m))
	t -= 1


import math, sys, os, collections, functools, itertools, string
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for testcase in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.reverse()
	print(*arr)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = reversed(a)
	for j in b:
		print(j, end=' ')
	print()


from sys import stdin
import math
from collections import deque
from bisect import *
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(n,) = gil()
	a = gil()
	for v in reversed(a):
		print(v, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	p = list(input().split(' '))
	p = [int(num) for num in p]
	p_dash = list(reversed(p))
	print(*p_dash)


for i in range(int(input())):
	n = int(input())
	a = [int(X) for X in input().split()]
	print(*a[::-1])


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	y = x[::-1]
	print(*y)


import sys
T = int(sys.stdin.readline().strip())
for _ in range(T):
	n = int(sys.stdin.readline().strip())
	nums = list(map(int, sys.stdin.readline().strip().split()))
	print(' '.join(map(str, reversed(nums))))


import sys

def swap(x, y, a):
	temp = a[x]
	a[x] = a[y]
	a[y] = temp
	return a

def solve():
	return None

def main():
	q = []
	for line in sys.stdin.readlines():
		q.append(line)
	for i in range(len(q)):
		q[i] = q[i].rstrip().split(' ')
		q[i] = [int(x) for x in q[i]]
	for i in range(1, len(q), 2):
		a = q[i + 1]
		a = a[::-1]
		a = [str(i) for i in a]
		print(' '.join(a))
main()


t = int(input())
for i in range(0, t):
	n = int(input())
	a = list(input().split())
	a.reverse()
	print(' '.join(a))


t = int(input())
for _ in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	x = []
	for j in range(len(lst)):
		x.append(lst[-1 - j])
	print(*x)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.reverse()
	for e in arr:
		print(e, end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	print(*p[::-1], sep=' ')


import os
import sys
from io import BytesIO, IOBase

def solution(arr):
	write(*arr[::-1])

def main():
	for _ in range(r_int()):
		n = r_int()
		arr = r_array()
		solution(arr)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(str(args[-1]))
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())
main()


import math
from collections import deque
from collections import defaultdict
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = list(map(int, input().strip().split(' ')))
	arr = arr[::-1]
	for i in range(n):
		print(arr[i], end=' ')
	print()


def do():
	n = int(input())
	dat = list(map(int, input().split()))
	dat.reverse()
	print(' '.join(list(map(str, dat))))
q = int(input())
for _ in range(q):
	do()


T = int(input())
for t in range(1, T + 1):
	N = int(input())
	lst = input().split()
	for i in range(N - 1, -1, -1):
		print(lst[i], ' ', end='')
	print()


t = int(input())
while t > 0:
	n = int(input())
	lst = list(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		print(lst[i], end=' ')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	an = []
	if n % 2 == 0:
		an = a[::-1]
	else:
		an.append(a[-1])
		del a[-1]
		an = an + a[::-1]
	print(' '.join(map(str, an)))


f = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	a = list(f())
	print(*a[::-1])


def run():
	output = []
	for i in range(int(input())):
		_ = input()
		rev = input().split()
		rev.reverse()
		output.append(' '.join(rev))
	print('\n'.join(output))
run()


import sys
import time as mt, bisect, sys
import math
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict

def si():
	return int(sys.stdin.readline())

def st():
	return stdin.readline()

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

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

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)
test = si()
for _ in range(test):
	n = si()
	list1 = lis()
	a = []
	for i in range(n - 1, -1, -1):
		a.append(list1[i])
	print(*a)


a = int(input())
for i in range(0, a):
	o = int(input())
	i = list(map(int, input().split()))
	k = i[::-1]
	h = ''
	for j in k:
		h += str(j) + ' '
	print(h)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	n = I()
	a = li()
	print(*a[::-1])
for _ in range(I()):
	solve()


for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	e = []
	for i in range(n):
		e.append(p[n - 1 - i])
	print(*e)


from functools import lru_cache
from sys import stdin, stdout
import sys
from math import *
for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	print(*ar[::-1])


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 5
T = 1
T = int(stdin.readline())
for _ in range(T):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	a.reverse()
	print(*a)


import sys, io, os, time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
for ii in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	f = []
	for i in range(1, n):
		f.append(arr[i - 1] + arr[i])
	print(*arr[::-1])


for _ in range(int(input())):
	n = int(input())
	perms = [int(i) for i in input().split()]
	new = []
	for i in range(len(perms) - 1, -1, -1):
		new.append(perms[i])
	print(' '.join([str(i) for i in new]))


t = int(input())
while t != 0:
	n = int(input())
	ar = list(map(int, input().split()))
	ar.reverse()
	for i in range(0, n):
		print(ar[i], end=' ')
	print('')
	t -= 1


import math
for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	A = A[::-1]
	print(*A)


numberofcases = int(input())
for _ in range(numberofcases):
	n = int(input())
	l = input().split()
	l.reverse()
	print(' '.join(l))


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
for testcases in range(int(input())):
	num = int(input())
	lis = li()
	lis.reverse()
	print(*lis)


import math
for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	p.reverse()
	print(*p)


import sys
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, sys.stdin.readline().split()))
	rev_lst = list(reversed(lst))
	print(' '.join(map(str, rev_lst)))


for i in range(int(input())):
	n = int(input())
	lis = [int(x) for x in input().split()]
	lis.reverse()
	print(*lis)


for _ in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	for x in reversed(p):
		print(x, end=' ')
	print()


T = int(input().rstrip())
for test in range(T):
	n = int(input().rstrip())
	perm = [int(x) for x in input().rstrip().split()]
	rev_perm = reversed(perm)
	print(*rev_perm)


t = int(input(''))
arr = []
for i in range(t):
	int(input(''))
	arr.append(list(map(int, input().split())))
for i in arr:
	n = len(i)
	sol = []
	for j in range(n - 1, -1, -1):
		sol.append(i[j])
	print(*sol)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda : map(int, stdstr().split())
mod = 1000000007
for _ in range(stdint()):
	n = stdint()
	arr = list(stdarr())
	print(*arr[::-1])


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	print(' '.join((str(x) for x in reversed(a))))


from sys import stdin
intput = stdin.readline
t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	arr = list(map(int, input().split()))
	for x in range(n - 1, -1, -1):
		print(arr[x], end=' ')


t = int(input())
while t > 0:
	n = int(input())
	l = [int(x) for x in input().split()]
	l = l[::-1]
	print(*l)
	t -= 1


def permutation(A):
	return A[::-1]
t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	val = permutation(A)
	print(*val)


import sys
input = sys.stdin.readline
from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	print(*lis[::-1])


MOD = 1000000007
from collections import defaultdict as dd, Counter, deque

def si():
	return input()

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

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

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

def out(v):
	print(v)

def spout():
	print(v, end=' ')

def d2b(n):
	return bin(n).replace('0b', '')

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ispow2(x):
	return x and (not x & x - 1)

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)
t = ii()
while t:
	t -= 1
	n = ii()
	a = li()
	print(' '.join((str(i) for i in a[::-1])))


import itertools

def solution(n, p):
	return p[::-1]
t = int(input())
for _ in range(t):
	n = map(int, input().split(' '))
	p = list(map(int, input().split(' ')))
	print(*solution(n, p))


a = int(input())
for i in range(a):
	b = int(input())
	l = list(map(int, input().split()))
	l.reverse()
	print(*l)


def main():
	n = int(input().strip())
	arr = list(map(int, input().strip().split()))
	arr.reverse()
	print(*arr)
for _ in range(int(input())):
	main()


import math as mt
import sys, string
from collections import Counter, defaultdict
input = sys.stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
ARR = lambda : list(map(int, input().split()))

def main():
	n = I()
	arr = ARR()
	for i in range(n - 1, -1, -1):
		print(arr[i], end=' ')
	print()
tc = I()
for _ in range(tc):
	main()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	n = int(inp())
	a = lis()
	a = a[::-1]
	print(' '.join((str(a[i]) for i in range(n))))
testcase(int(inp()))


for _ in range(int(input())):
	n = int(input())
	p = [int(c) for c in input().split()]
	for x in p[::-1]:
		print(x, end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	arr = [int(d) for d in input().split()]
	for i in range(n - 1, -1, -1):
		print(arr[i], end=' ')
	print(end='\n')


t = int(input())
for case in range(t):
	n = int(input())
	a = input().split(' ')
	print(' '.join(a[::-1]))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a.reverse()
	for x in a:
		print(x, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	p = [int(x) for x in input().split()]
	p = p[::-1]
	for e in p:
		print(e, end=' ')
	print()


for i in range(int(input())):
	if int(input()) >= 2:
		r = list(map(int, input().split()))
		r = r[::-1]
		print(*r)


for _ in range(int(input())):
	input()
	print(' '.join(reversed(input().split())))


t = 1
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	for el in reversed(a):
		print(el, end=' ')
	print()


def forge_perm(arr):
	return arr[::-1]
n = int(input())
for i in range(n):
	size = int(input())
	arr = list(input().split())
	result = forge_perm(arr)
	res = ' '.join(result)
	print(res)


def solve():
	n = int(input())
	l = list(map(int, input().split()))
	return reversed(l)
for __ in range(int(input())):
	for e in solve():
		print(e, end=' ')
	print()


import sys
from typing import List, Union

def rl(int_: bool=True, is_split: bool=True) -> Union[List[str], List[int]]:
	if int_:
		return [int(w) for w in sys.stdin.readline().split()]
	if is_split:
		return [w for w in sys.stdin.readline().split()]
	return sys.stdin.readline().strip()
for _ in range(rl()[0]):
	(n,) = rl()
	p = rl(False)
	print(' '.join(reversed(p)))


import sys
pin = sys.stdin.readline
for t in range(int(pin())):
	N = int(pin())
	P = [*map(int, pin().split())]
	for p in P[::-1]:
		print(p, end=' ')
	print()


from sys import *
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	a = a[::-1]
	print(*a)


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	l2 = []
	for i in range(len(a) - 1, -1, -1):
		l2.append(a[i])
	print(*l2)
	t = t - 1


import sys
pprint = lambda s: print(' '.join(map(lambda x: str(x), s)))
input = lambda : sys.stdin.readline().strip()
ipnut = input
mod = 1000000007
for i in range(int(input())):
	n = int(input())
	p = list(map(int, input().split()))
	pprint(reversed(p))


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		n = int(input())
		arry = list(map(int, input().split()))
		yield ' '.join((str(x) for x in arry[::-1]))
t = int(input())
ans = gift()
print(*ans, sep='\n')


from sys import stdin, stdout, setrecursionlimit
import heapq
from math import gcd, ceil, sqrt
from collections import Counter, deque
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007
tc = ii1()
for _ in range(tc):
	n = ii1()
	arr = iia()
	res = []
	if n % 2 == 0:
		res = arr[n // 2:][::-1] + arr[0:n // 2][::-1]
	else:
		res = arr[n // 2 + 1:][::-1] + [arr[n // 2]] + arr[0:n // 2][::-1]
	print(*res)


def main(n, a):
	a.reverse()
	return a
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	print(*list(main(n, a)))


t = int(input())
answer = []
for _ in range(t):
	n = int(input())
	perm = list(map(int, input().split(' ')))
	temp = []
	for i in range(n):
		temp.append(str(perm[n - 1 - i]))
	answer.append(' '.join(temp))
print('\n'.join(answer))


for _ in range(int(input())):
	n = int(input())
	list1 = [int(x) for x in input().split()]
	list1.reverse()
	for i in range(len(list1)):
		print(list1[i], end=' ')
	print()


T = int(input())
while T != 0:
	T -= 1
	n = int(input())
	a = list(map(int, input().split()))
	a = a[::-1]
	for x in a:
		print(x, end=' ')
	print()


import math
import re
import itertools
import copy
import time
import sys

def input_linear(lamb=lambda x: int(x), seperator=' '):
	return map(lamb, input().split(seperator))

def input_array(lamb=lambda x: int(x), seperator=' '):
	return list(map(lamb, input().split(seperator)))

def input_matrix(rows, lamb=lambda x: int(x), seperator=' '):
	tmp_matrix = []
	for i in range(rows):
		tmp_matrix.append(input_array(lamb, seperator))
	return tmp_matrix

def input_graph_al_pair(vertices, lines, lamb=lambda x: int(x), seperator=' ', directional=False, remove_dup=False):
	temp_matrix = [x[:] for x in [[]] * vertices]
	if not directional:
		if not remove_dup:
			for i in range(lines):
				(ina, inb) = input_linear(lamb, seperator)
				temp_matrix[ina].append(inb)
				temp_matrix[inb].append(ina)
		else:
			for i in range(lines):
				(ina, inb) = input_linear(lamb, seperator)
				if inb not in temp_matrix[ina]:
					temp_matrix[ina].append(inb)
				if ina not in temp_matrix[inb]:
					temp_matrix[inb].append(ina)
		return temp_matrix
	else:
		if not remove_dup:
			for i in range(lines):
				(ina, inb) = input_linear(lamb, seperator)
				temp_matrix[ina].append(inb)
		else:
			for i in range(lines):
				(ina, inb) = input_linear(lamb, seperator)
				if inb not in temp_matrix[ina]:
					temp_matrix[ina].append(inb)
		return temp_matrix
for _ in range(int(input())):
	n = int(input())
	a = input_array()
	a.reverse()
	print(' '.join(map(str, a)))


from sys import stdin, stdout
for i in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().strip().split()))
	m = a[::-1]
	print(*m, sep=' ')


m = int(input())
for i in range(m):
	n = int(input())
	p = list(map(int, input().split(' ')))
	for j in range(n - 1, -1, -1):
		print(p[j], end=' ')


from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
	n = map(int, input())
	l = list(map(int, input().split()))
	l.reverse()
	print(' '.join((str(i) for i in l)))


T = int(input())
for t in range(T):
	n = int(input())
	p = list(map(int, input().split()))
	for i in range(n - 1, -1, -1):
		print(p[i], end=' ')
	print('')


t = int(input())
for z in range(t):
	N = int(input())
	m = []
	l = list(map(str, input().split()))
	for i in range(N - 1, -1, -1):
		m.append(l[i])
	p = ' '.join(m)
	print(p)


import sys
from itertools import permutations
from collections import defaultdict
name = sys.stdin.read()
jobGrid = []
isJob = True
row = []
grid = name.split('\n')
grid = grid[:-1]
number_of_cases = int(grid[0])
for i in range(number_of_cases):
	l = list(map(int, grid[i * 2 + 2].split()))
	ans = l[::-1]
	print(*ans)


import sys
input = sys.stdin.readline
import random

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())
x = inp()
ansl = []
bog = []
log = []
for i in range(x):
	notd = inp()
	y = inlt()
	y.reverse()
	ansl.append(y)
for i in ansl:
	print(*i)


N = int(input())
for i in range(N):
	n = int(input())
	p = list(map(int, input().split()))
	l = len(p)
	a = [p[l - j - 1] for j in range(l)]
	print(' '.join([str(k) for k in a]))


def main():
	trials = input()
	for i in range(int(trials)):
		input()
		perm = input().split()
		perm.reverse()
		print(' '.join(perm))
main()


from collections import Counter
from collections import defaultdict
from collections import deque
import math
import heapq
import sys
import io, os
input = sys.stdin.readline
from bisect import *
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().strip().split()))
rls = lambda : list(map(str, input().split()))
t = int(input())
for _ in range(0, t):
	n = int(input())
	a = rl()
	a.reverse()
	print(*a)


def solve(arr, n):
	temp = []
	for i in range(n - 1, -1, -1):
		temp.append(arr[i])
	for x in temp:
		print(x, end=' ')
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	solve(arr, n)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	s = arr[::-1]
	print(' '.join((str(e) for e in s)))


for s in [*open(0)][2::2]:
	print(*map(int, s.split()[::-1]))


T = int(input())
for t in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	A.reverse()
	for a in A:
		print(a, end=' ')
	print('')


res = []
for x in range(int(input())):
	l = []
	a = int(input())
	b = list(map(int, input().split()))
	for y in b[::-1]:
		n = str(y)
		l.append(n)
	sep = ' '
	ans = sep.join(l)
	res.append(ans)
for y in res:
	print(y)


for test in range(int(input())):
	n = int(input())
	for val in list(map(int, input().split()))[::-1]:
		print(val, end=' ')
	print()


t = int(input())
for test in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = a[::-1]
	print(*b)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(*arr[::-1], sep=' ')


for i in range(int(input())):
	k = int(input())
	x = [int(i) for i in input().split()]
	print(*x[::-1])


a = int(input())
for x in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	print(*c[::-1])


T = int(input())
while T:
	n = int(input())
	arr = list(map(int, input().split()))
	print(*arr[::-1])
	T -= 1


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))[:n]
	for num in arr[::-1]:
		print(num, end=' ')
	print()


n = int(input())
for k in range(n):
	o = int(input())
	arr = [int(x) for x in input().split()]
	line = ''
	for i in reversed(range(len(arr))):
		line += str(arr[i]) + ' '
	print(line.strip())


from math import gcd
from bisect import bisect_left, bisect_right
from itertools import combinations
from itertools import permutations
from bisect import bisect_left
from math import ceil
from math import radians
from heapq import heapify, heappush, heappop
import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

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

def si():
	return str(input())

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

def li1():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0 and i % 2 == 1:
			s.add(i)
			n = n // i
	if n > 2 and n % 2 == 1:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def nextPowerOf2(n):
	count = 0
	if n and (not n & n - 1):
		return n
	while n != 0:
		n >>= 1
		count += 1
	return 1 << count

def cou(n):
	c = 0
	while n > 1:
		c += 1
		n //= 2
	return c

def sortsec(l):
	return sorted(l, key=lambda x: x[1])

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def subarray(A):
	r = set()
	p = {0}
	for x in A:
		p = {x | y for y in p} | {x}
		r |= p
	return len(r)
for _ in range(ii()):
	n = ii()
	l = li1()
	print(*l[::-1])


import os
t = int(input().rstrip())
for _ in range(t):
	length = int(input())
	arr = list(map(int, input().rstrip().split()))
	for i in reversed(arr):
		print(i, end=' ')
	print('')


test_cases = int(input())
for test in range(test_cases):
	n = int(input())
	arr = [int(i) for i in input().split()]
	arr1 = [arr[n - i - 1] for i in range(n)]
	s = ''
	for j in range(n):
		s = s + str(arr1[j]) + ' '
	print(s)


a = int(input())
for i in range(a):
	x = int(input())
	l = list(map(int, input().split()))
	c = 0
	d = []
	if x % 2 != 0:
		for i in reversed(range(x)):
			print(l[i], end=' ')
	else:
		for i in reversed(range(x)):
			print(l[i], end=' ')


t = int(input())
while t:
	t -= 1
	n = int(input())
	lst = list(map(int, input().split()))
	lst.reverse()
	print(*lst)


import os
import heapq
import sys, threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10 ** 5)
from io import BytesIO, IOBase

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

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = inar()
		print(*arr[::-1])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


a = int(input())
for _ in range(a):
	int(input())
	s = input().split()
	s.reverse()
	print(*s)


tt = int(input())
while tt:
	tt -= 1
	y = int(input())
	x = list(map(int, input().split()))
	from itertools import permutations
	x.reverse()
	print(' '.join(map(str, x)))


from sys import stdin

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

def get_str():
	return stdin.readline().strip()

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

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

def get_array2d(row):
	return [list(map(int, stdin.readline().strip().split())) for _ in range(row)]
T = get_int()
for _ in range(T):
	N = get_int()
	P = get_array()
	print(*P[::-1])


import sys
input = sys.stdin.readline
from bisect import bisect_left
from bisect import bisect_right
from math import ceil, factorial

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

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

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	n = int(input())
	a = int_array()
	a = a[::-1]
	print(*a)


import sys
import itertools
import math
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n,) = I()
while n:
	(k,) = I()
	arr = I()
	print(*reversed(arr))
	n -= 1


for _ in range(int(input())):
	n = int(input())
	arr = [*map(int, input().split())]
	print(*arr[::-1])


import sys
from itertools import permutations
from itertools import combinations
from itertools import combinations_with_replacement
for _ in range(int(input())):
	n = int(input())
	liStr = input().split()
	arr = []
	for i in liStr:
		arr.append(int(i))
	arr.reverse()
	for i in arr:
		print(i, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	lol = [int(n) for n in input().split()]
	lol.reverse()
	print(*lol)


from sys import stdin
for _ in range(int(stdin.readline())):
	stdin.readline()
	print(*list(map(int, stdin.readline().split()))[::-1])


import math
for test in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	for i in reversed(a):
		print(i, end=' ')
	print()


from sys import stdin, stdout

class SOLVE:

	def solve(self):
		R = stdin.readline
		W = stdout.write
		for i in range(int(input())):
			n = int(input())
			a = [int(x) for x in R().split()]
			a.reverse()
			print(*a)

def main():
	s = SOLVE()
	s.solve()
main()


t = int(input())
for i in range(t):
	n = int(input())
	mas = list(map(int, input().split()))
	print(' '.join(map(str, mas[::-1])))


try:
	t = int(input())
	for _ in range(t):
		n = int(input())
		ar = [int(i) for i in input().split()]
		for j in reversed(ar):
			print(j, end=' ')
		print()
except EOFError:
	print('')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = l[-1::-1]
	f = ''
	for i in ans:
		f += str(i) + ' '
	print(f)


import sys
input = sys.stdin.readline
import heapq
import copy
import math
import decimal

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

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

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

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

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

def pr_list(a):
	print(*a, sep=' ')

def swap(a, b):
	temp = a
	a = b
	b = temp
	return [a, b]

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	ans = 0
	stack = []
	hashm = {}
	arr = []
	heapq.heapify(arr)
	for test in range(tests):
		n = inp()
		a = inlt()
		a.reverse()
		pr_list(a)
main()


import math
t = int(input())
while t > 0:
	n = int(input())
	p = list(map(int, input().split()))
	p.reverse()
	for num in p:
		print(num, end=' ')
	print('')
	t -= 1


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	p = [int(i) for i in input().split() if i != '\n']
	p.reverse()
	print(*p)


cases = int(input())
for t in range(cases):
	n = int(input())
	p = list(map(int, input().split()))
	print(*p[::-1])


def saurabh(n, arr):
	print(*arr[::-1])
for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	saurabh(n, arr)


T = int(input())
while T > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	arr.reverse()
	print(*arr)
	T -= 1


import sys
input = sys.stdin.readline
for nt in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(*a[::-1])


for _ in range(int(input())):
	n = int(input())
	s = input()
	print(*map(int, s.split()[::-1]))


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	b = []
	for i in range(n - 1, -1, -1):
		b.append(a[i])
	print(*b, sep=' ')


t = int(input())
lst = []
for i in range(t):
	lst.append([input(), input().split()])
for i in lst:
	pp = i[-1][::-1]
	print(*pp)


t = int(input())
for _ in range(t):
	n = int(input())
	p = [int(x) for x in input().split()]
	p.reverse()
	print(' '.join([str(x) for x in p]))


import sys, math, cmath, time
start_time = time.time()

def solve():
	n = inp()
	a = inlt()
	a.reverse()
	print(*a)

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

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

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

def insr():
	return input().strip()

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

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b

def factorial(n, m=1000000007):
	q = 1
	for i in range(n):
		q = q * (i + 1) % m
	return q
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


def solve():
	n = int(input())
	P = input().split()
	P.reverse()
	for p in P:
		print(p, end=' ')
	print()
t = int(input())
while t:
	solve()
	t -= 1


def solve():
	n = int(input())
	p = list(map(int, input().split()))
	a = list(p[::-1])
	for i in range(n):
		print(a[i], end=' ')
	print('\n', end='')
T = int(input())
for i in range(T):
	solve()


T = int(input())
for t in range(T):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	result = arr[::-1]
	print(*result, sep=' ')


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	p = [int(j) for j in sys.stdin.readline().split()]
	for x in range(n - 1, -1, -1):
		print(p[x], end=' ')
	print()


for t in range(int(input())):
	l = int(input())
	a = list(map(int, input().split()))
	b = []
	a.reverse()
	b.append(a)
	for i in range(l):
		print(b[0][i])


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	n = ii()
	a = il()
	l = []
	for i in range(n - 1, -1, -1):
		l.append(a[i])
	print(*l)


from collections import defaultdict as dd
import sys
input = sys.stdin.readline
t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	l.reverse()
	print(*l)
	t -= 1


try:
	for _ in range(int(input())):
		n = int(input())
		l = list(map(int, input().split()))
		l.reverse()
		print(*l)
except:
	pass


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	fp = []
	arr = list(map(str, arr))
	print(' '.join(arr[::-1]))


T = int(input())
ans = [0] * T
for t in range(T):
	N = int(input())
	P = list(map(int, input().split()))
	ans[t] = P[::-1]
for a in ans:
	print(*a)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)
ii = lambda : int(input())
si = lambda : input()
jn = lambda x, l: x.join(map(str, l))
sl = lambda : list(map(str, input().strip()))
mi = lambda : map(int, input().split())
mif = lambda : map(float, input().split())
lii = lambda : list(map(int, input().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
mod = 1000000007
for _ in range(ii()):
	n = ii()
	arr = lii()
	arr.reverse()
	print(*arr)


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	nstr = ''
	np = p[::-1]
	for i in range(n):
		nstr += f'{np[i]} '
	print(nstr)


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
t = ini()
for _ in range(t):
	n = ini()
	a = inl()
	print(*a[::-1])


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

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

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

def inputstring():
	return [x for x in input()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	p = inputlist()
	for i in reversed(range(n)):
		print(p[i], end=' ')
	print()


def main():
	T = int(input())
	for _ in range(T):
		_ = int(input())
		P = [int(i) for i in input().split()]
		print(*P[::-1])
main()


T = int(input())
for t in range(T):
	n = int(input())
	A = [int(i) for i in input().split()]
	print(*A[::-1])


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	k = list(reversed(l))
	print(*k)


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	for x in range(n - 1, -1, -1):
		print(a[x], end=' ')
	print()
	t -= 1


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


from sys import stdin
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, stdin.readline().rstrip().split(' ')))
	print(*l[::-1])


from collections import Counter, defaultdict as dft

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

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

def solve():
	n = int(input())
	arr = ml()
	print(*arr[::-1])
t = int(input())
for _ in range(t):
	solve()


for i in range(int(input())):
	whatever = input()
	lista = input().split()
	for k in range(len(lista)):
		lista[k] = int(lista[k])
	lista.reverse()
	for j in range(len(lista)):
		print(lista[j], end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	p = list(map(int, input().split()))
	p1 = p[::-1]
	for j in p1:
		print(j, end=' ')


for ii in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	print(*a[::-1])


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	print(*a[::-1])
for _ in range(int(input())):
	solve()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	N = int(input())
	a = list(map(int, input().split()))
	a.reverse()
	print(*a)


def func():
	num = int(input())
	l = list(map(int, input().split()))
	s = ''
	for i in l[::-1]:
		s += f'{i} '
	return s
final = list()
for i in range(int(input())):
	final.append(func())
print(*final, sep='\n')


t = int(input())
for i in range(t):
	n = int(input())
	ar = [int(i) for i in input().split()]
	bar = ar[::-1]
	print(' '.join((str(i) for i in bar)))


from fractions import Fraction
import bisect
import os
import io
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate
from queue import Queue

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

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
t = 1
t = iinput()
for i in range(t):
	n = iinput()
	a = rlinput()
	print(*a[::-1])


def solve(n, arr):
	arr = arr[::-1]
	print(*arr, sep=' ')
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	solve(n, a)


for _ in range(int(input())):
	n = int(input())
	num = [int(i) for i in input().split()]
	for i in range(n - 1, -1, -1):
		print(num[i], end=' ')
	print()


for _ in range(int(input())):
	n = int(input())
	arr = input().split()
	arr.reverse()
	print(' '.join(arr))


from sys import stdin
input = lambda : stdin.readline().strip()
import math
from collections import deque as d
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(*a[::-1])


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
import sys
letters = ascii_letters
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	print(*list(map(int, input().split()))[::-1])


z = int(input())
for t in range(z):
	n = int(input())
	arr = list(map(int, input().split()[:n]))
	print(*arr[n - 1::-1])


from sys import stdin, stdout
from collections import deque as dq
input = stdin.readline

def sol(a):
	b = []
	for i in range(n - 1):
		b.append(a[i] + a[i + 1])
	return b
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(*a[::-1])


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	for x in range(len(a)):
		y = n - x - 1
		print(a[y], end=' ')
	print()
t = int(input())
for x in range(t):
	solve()


t = int(input())
for x in range(t):
	n = int(input())
	P = list(map(int, input().split()))
	print(*P[::-1])


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	l2 = lis[::-1]
	for i in l2:
		print(i, end=' ')


for _ in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	l = l[::-1]
	print(*l, sep=' ')


t = int(input())
for j in range(t):
	n = int(input())
	ara = list(map(int, input().strip().split()))
	ara.reverse()
	print(*ara, sep=' ')


for _ in range(int(input())):
	N = int(input())
	List = [int(x) for x in input().split()]
	List.reverse()
	print(*List)


def answer(n, arr):
	k = arr[::-1]
	return k
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	print(*answer(n, arr))


def per_forg(arr):
	arr.reverse()
	return arr
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	res = per_forg(arr)
	print(*res, sep=' ')


t = int(input())
for ii in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	if n % 2 == 0:
		a.reverse()
	else:
		a.reverse()
	for i in a:
		print(i, end=' ')
	print()


t = int(input())

def reve(li):
	li.reverse()
	return li
for _ in range(t):
	n = int(input())
	ar = list(map(int, input().split()))
	ar.reverse()
	for i in range(n):
		if i == n - 1:
			print(ar[i])
		else:
			print(ar[i], end=' ')


import math
import collections
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2 ** 20)
t = 1
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	print(*a[::-1])


from sys import stdin

class Problem:

	def __init__(self, n, a):
		self.n = n
		self.a = a

	def solve(self):
		return self.a[::-1]
cases = int(stdin.readline())
for test in range(cases):
	n = map(int, stdin.readline().split())
	a = list(map(int, stdin.readline().split()))
	ans = Problem(n, a).solve()
	print(' '.join(map(str, ans)))


for aww in range(int(input())):
	a = int(input())
	b = [*map(int, input().split())]
	b.reverse()
	print(' '.join(map(str, b)))


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	for x in range(n - 1, -1, -1):
		print(a[x], end=' ')
	print()


T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	A.reverse()
	print(*A)


n = int(input())
l = []
temp = []
for i in range(n):
	k = int(input())
	lst = [int(x) for x in input().split()]
	l.append(lst[::-1])
for i in l:
	print(*i)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	l = l[::-1]
	s = ''
	for i in l:
		s = s + str(i) + ' '
	print(s)


for _ in range(int(input())):
	x = int(input())
	a = [int(t) for t in input().split()]
	print(*a[::-1])


from collections import deque
from collections import Counter
from itertools import permutations
import heapq

def counterExample():
	arr = [1, 3, 4, 1, 2, 1, 1, 3, 4, 3, 5, 1, 2, 5, 3, 4, 5]
	counter = Counter(arr)
	top_three = counter.most_common(3)
	print(top_three)
q = deque()

def main():
	t = int(input())
	while t >= 1:
		t -= 1
		n = int(input())
		a = [int(i) for i in input().split()]
		print(' '.join([str(i) for i in a[::-1]]))
main()


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	n = I()
	print(*list(reversed(L())))


import math, queue, heapq
import sys
sys.setrecursionlimit(10 ** 6)
fastinput = sys.stdin.readline
fastout = sys.stdout.write
t = int(fastinput())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, fastinput().split()))
	a = a[::-1]
	print(*a)


tests = int(input())
for t in range(tests):
	n = int(input())
	ls = input().split()
	ls = ls[::-1]
	print(' '.join(ls))


from math import *
from bisect import *
from collections import Counter, defaultdict, deque
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	a = LI()
	for i in range(n - 1, -1, -1):
		print(a[i], end=' ')
	print()


from sys import stdin, stdout
input = stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	(*a,) = map(int, input().split())
	print(*a[::-1])


from collections import Counter
for _ in range(int(input())):
	s = int(input())
	a = list(map(int, input().split()))
	print(*a[::-1])


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	arr.reverse()
	for num in arr:
		print(num, end=' ')


t_case = int(input())
for _ in range(t_case):
	l = int(input())
	arr = list(map(int, input().split()))
	for i in range(l - 1, -1, -1):
		print(arr[i], end=' ')
	print()


for _ in range(int(input())):
	N = int(input())
	X = list(map(int, input().split()))
	print(*X[::-1])


import math
test = int(input())
for t in range(test):
	n = int(input())
	A = list(map(int, input().split()))
	A = A[::-1]
	print(*A)


import sys, threading
sys.setrecursionlimit(10 ** 8)
threading.stack_size(10 ** 8)
from collections import defaultdict, Counter
from queue import Queue
import math

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		vals = list(input().split())
		print(' '.join(vals[::-1]))
threading.Thread(target=main).start()


T = int(input())
for z in range(T):
	n = int(input()) - 1
	p = [int(x) for x in input().split()]
	while n > 0:
		print(p[n], end=' ')
		n -= 1
	print(p[0])


import math
for _ in range(int(input())):
	n = map(int, input().split())
	a = [int(i) for i in input().split()]
	print(*a[::-1])


for _ in range(int(input())):
	a = int(input())
	b = [int(x) for x in input().split()]
	b.reverse()
	print(*b)


def forge(n, a):
	ans = a[::-1]
	return ans
res = []
n = int(input())
for i in range(n):
	p = int(input())
	arr = list(map(int, input().split()))
	res.append(forge(p, arr))
for j in res:
	print(*j)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

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

def out(var, end='\n'):
	sys.stdout.write(str(var) + end)

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	arr = l()
	outa(*arr[::-1])


for _ in range(int(input())):
	lens = int(input())
	arrs = [int(x) for x in input().split()]
	print(*arrs[::-1])


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	list_num = list(map(int, sys.stdin.readline().split()))
	print(*[list_num[-1 - i] for i in range(n)])


t = int(input())
for i in range(t):
	l = int(input())
	Nums = [int(i) for i in input().split()]
	for j in range(1, len(Nums) + 1):
		print(Nums[-1 * j], end=' ')


t = int(input())
for _ in range(t):
	n = int(input())
	c = []
	c1 = []
	l = list(map(int, input().split()))
	l.reverse()
	print(*l)


T = int(input())
for I in range(0, T):
	N = int(input())
	X = input().split()
	print(' '.join(X[::-1]))


import sys, math
input = sys.stdin.readline
t = int(input())
for r in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = l[::-1]
	for i in l:
		print(i, end=' ')
	print()


import time, math as mt, bisect as bs, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

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

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * (2 * 10 ** 5 + 5)
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(2 * 10 ** 5 + 5):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(n, e):
	adj = [set() for i in range(n + 1)]
	for i in range(e):
		(u1, u2) = IP()
		adj[u1].add(u2)
	return adj
mod = 10 ** 9 + 7

def solve():
	n = II()
	p = L()
	ans = p[::-1]
	print(*ans)
	return
t = II()
for i in range(t):
	solve()


t = int(input())
while t:
	t -= 1
	n = int(input())
	old_L = [int(_) for _ in input().split(' ')]
	new_L = old_L[::-1]
	print(*new_L)


t = int(input())

def abc(l, n, k):
	for j in range(1, n + 1):
		if k != j:
			c = [j]
			for b in l:
				x = b - c[-1]
				if x >= 1 and x <= n:
					c.append(x)
			if len(set(c)) == n:
				print(*c)
				return
	return
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	print(*l[-1::-1])


def solve(A, n):
	A.reverse()
	return A
t = int(input())
while t:
	t -= 1
	n = int(input())
	A = [i for i in map(int, input().strip().split())]
	res = solve(A, n)
	for a in res:
		print(a, end=' ')
	print()


import math
num_cases = int(input())
for _ in range(num_cases):
	n = int(input())
	s = input().strip().split()
	for i in range(n - 1, -1, -1):
		print(s[i], end=' ')
	print()


def switch(a):
	for i in range(0, n // 2):
		temp = a[i]
		a[i] = a[n - i - 1]
		a[n - i - 1] = temp
	return a
t = int(input())
for _ in range(t):
	n = int(input())
	p = [int(i) for i in input().split()]
	p1 = switch(p)
	print(*p1)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

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

def ws(s):
	sys.stdout.write(s + '\n')

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for i in range(ri()):
		n = ri()
		a = ria()
		print(*a[::-1])
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


T = int(input())
for _ in range(T):
	n = int(input())
	x = list(map(int, input().split()))
	y = x[::-1]
	s = ''
	for i in y:
		s += str(i) + ' '
	print(s)


for i in range(int(input())):
	n = int(input())
	l = [int(c) for c in input().split()]
	l = reversed(l)
	print(*l)


from sys import stdin

def input():
	return stdin.readline().rstrip()
t = int(input())
for i in range(t):
	l = int(input())
	z = list(map(int, input().split()))
	z.reverse()
	print(*z)


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	lst.reverse()
	for i in lst:
		print(i, end=' ')
	print()


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = ''
	i = n - 1
	while i >= 0:
		a = a + str(l[i]) + ' '
		i -= 1
	print(a)


def calc(p):
	p.reverse()
	return p

def get_ints():
	return [int(n) for n in input().split()]

def get_floats():
	return [float(n) for n in input().split()]

def seq2str(seq):
	return ' '.join((str(item) for item in seq))
zzz = get_ints()
assert len(zzz) == 1
t = zzz[0]
for i in range(t):
	zzz = get_ints()
	assert len(zzz) == 1
	n = zzz[0]
	zzz = get_ints()
	assert len(zzz) == n
	p = zzz
	res = calc(p)
	print(seq2str(res))


import sys
read = lambda : sys.stdin.readline().strip()
for _ in range(int(read())):
	n = read()
	nums = list(map(int, read().split()))
	for i in nums[::-1]:
		print(i, end=' ')
	print()


def main():
	n = int(input())
	print(*input().split()[::-1])
t = int(input())
for _ in range(t):
	main()


t = int(input())
for i in range(t):
	t2 = int(input())
	l = [int(j) for j in input().split(' ')][:t2]

	def rev_list(l):
		n = len(l)
		ls = []
		for i in range(len(l)):
			ls.append(l[n - 1 - i])
		return ls
	lm = rev_list(l)
	s = ''
	for i in lm:
		s = s + str(i) + ' '
	print(s[:-1])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.reverse()
	ans = ' '.join((str(x) for x in a))
	print(ans)


intput = lambda : int(input())
narr = lambda : map(int, input().split())
for _ in range(intput()):
	n = intput()
	a = list(narr())
	print(' '.join(map(str, a[::-1])))


t = int(input())
while t:
	n = int(input())
	li = [int(x) for x in input().split()]
	for i in range(int(n / 2)):
		(li[i], li[n - i - 1]) = (li[n - i - 1], li[i])
	for i in range(n):
		print(li[i], end=' ')
	print()
	t = t - 1