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]$.

Starter code:

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

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

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

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

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())):
    n = int(input())
    a = list(map(int, input().split()))
    print(*a[::-1])

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

#!/usr/bin/env pypy3
	
T = int(input())
for t in range(T):
	input()
	P = input().split()
	print(*(P[::-1]))

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


T = int(input())

#lets = 'abcdefghijklmnopqrstuvwxyz'
#key = {lets[i]:i for i in range(26)}

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


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

t = int(input())

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

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

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

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

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

#!/usr/local/bin/python3
t = int(input())
for _ in range(t):
    n = int(input())
    arr=list(map(int,input().split()))
    result=arr[::-1]
    print(' '.join(map(str,result)))

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


import sys

# import math
# from collections import deque

# import heapq

# from math import inf
# from math import gcd

# print(help(deque))
# 26
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, k = map(int, input().split())
    n = int(input())
    p = list(map(int,input().split()))
    pprint(reversed(p))
# c = list(map(lambda x: int(x)-1, input().split()))


import sys
import math
# sys.stdin  = open("input.txt")
for _ in range(int(input())):
    n=int(input())
    a=[int(o) for o in input().split()]
    print(*a[::-1])

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

"""
Author: Q.E.D
Time: 2020-09-06 09:35:20
"""
T = int(input())
for _ in range(T):
    n = int(input())
    a = list(map(int, input().split()))
    print(' '.join(map(str, a[::-1])))

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

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


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


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


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



for T in range(int(input())) :
    n = int(input())
    l = input().split()
    print(*l[::-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
#print = stdout.write

for _ in range(int(input())):
    n = int(input())
    print(*(list(map(int, input().split()))[::-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()
"""
60, 61
"""
"""
"""

__starting_point()

for i in range(int(input())):
    n=int(input())
    a=list(map(int,input().split()))
    print(*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()


# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left, bisect_right
from functools import lru_cache
MOD = int(1e9)+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()


"""


"""