nobita-and-string-4
Source: hackerearth
Difficulty: EASY

Doraemon gave Nobita a gadget that swaps words inside a string in the following manner :

If there are W words, word 1 is swapped with word W, word 2 is swapped with word W-1 and so on.
The problem is that Nobita himself cannot verify the answer for large strings. Help him write a program to do so.

INPUT : 
the first line of the input contains the number of test cases. Each test case consists of a single line containing the string.

OUTPUT :
output the string with the words swapped as stated above.

CONSTRAINTS :
|string length| ≤ 100000
string contains english alphabets and spaces

SAMPLE INPUT
1
hello world

SAMPLE OUTPUT
world hello


n = eval(input())
x = []
for i in range(0 ,n):
	x.append(input().split())
for i in x:
	z = len(i)-1
	a = 0
	while a<z:
		temp = i[a]
		i[a] = i[z]
		i[z] = temp
		a = a+1
		z = z-1
	for q in range(0, len(i)):
		print(i[q], end=' ')
	print()


num_cases = int(input().rstrip("\n"))
for count in range(num_cases):
	input = input().rstrip("\n")
	words = input.split(" ")
	start = 0
	end = len(words) - 1
	for k in range(len(words) / 2):
		temp = words[start]
		words[start] = words[end]
		words[end] = temp
		start = start + 1
		end = end - 1
	print(" ".join(words))


n=input()
for i in range(int(n)):
	a=input()
	b=a.split()
	for j in range(len(b)/2):
		temp=b[j]
		b[j]=b[len(b)-j-1]
		b[len(b)-j-1]=temp
	print(" ".join(b))	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t=input()
t=int(t)
while t>0:
	s=input()
	l=s.split()
	length=len(l)
	for i in range(0,length/2):
		l[i],l[-(i+1)]=l[-(i+1)],l[i]
	res=""
	for e in l:
		res=res+e+" "
	print(res)
	t-=1


import sys
s=eval(input())
for i in range(0,s):
	c=input()
	C=c.split()
	A=[]
	for j in range(0,len(C)):
		A.append(C[j])
	
	m=0;
	n=len(A)-1;
	while(m<n):
		l=A[m]
		A[m]=A[n]
		A[n]=l
		m=m+1
		n=n-1
	for i in A:
		sys.stdout.write(i)
		sys.stdout.write(" ")
	print()
		
		
		
	


cases = int(input())
i = 1
output = []
while i <= cases :
	text = input().strip().split()
	l = len(text)
	text = list(text)
	i+=1
	for j in range(int(l/2)):
		temp = text[j]
		text[j] = text[l-1-j]
		text[l-1-j] = temp
	s = " ".join(text)
	output.append(s)
for item in output:
	print(item)



t=int(input())
while t>0:
	l=[]
	n=[]
	st=str(input())
	l=st.split()
	le=len(l)-1
	while le>-1:
		n.append(l[le])
		le=le-1
	print(" ".join(n))
	t=t-1


noc = int(input())
while noc:
	noc-=1
	curr = input()	
	clist= curr.split(" ")
	l = len(clist)
	for i in range(len(clist)/2):
		clist[i],clist[l-i-1] = clist[l-i-1],clist[i]
	print(" ".join(clist))	
		
	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

T = int(input())

while T:
	string = input()
	list_string = string.split(" ")
	#print list_string
	
	list_string.reverse()
	#print list_string
	
	new_string = ' '.join(list_string)
	
	print(new_string)
	T -= 1


T = eval(input())
temp = ''
templist = []
for i in range(0,T):
	string = input()
	string = string.split(" ")
	for i in range(0,len(string)/2):
		temp = string[i]
		string[i] = string[len(string)-1-i]
		string[len(string)-1-i] = temp
	print(" ".join(string))


import sys
n=int(input())
k=0
s1=""
li=[]
while(k<=n-1):
	ss=input()
	l=ss.split(" ")
	
	s1=" ".join(l[:: -1])+" "
	print(s1)
	k+=1


T = int(input())
for i in range(T):
	string = input()
	if len(string) <= 100000:
		stringList = string.split()
		half = len(stringList) / 2
		for i in range(half):
			stringList[i], stringList[len(stringList) - 1 - i] = stringList[len(stringList) - 1 - i], stringList[i]
    	print(' '.join(val for val in stringList))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
tc = int(input())
for t in range(0,tc):
	words = input().split()
	
	print(" ".join(words[::-1]))


t=int(input())
for i in range(t):
	list=input().split()
	l=len(list)
	for j in range(l):
		print((list[l-j-1]), end=' ')
	print("");


cases=int(input())
while(cases!=0):
	string=input()
	list1=string.split()
	lenth=len(list1)
	while(lenth>0):
		print(list1[lenth-1], end=' ')
		lenth=lenth-1
	print()
	cases=cases-1


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
n = int(input().strip())
for i in range(n):
	arr = input().strip().split(" ")
	for j in range(0, len(arr)/2):
		temp = arr[j]
		arr[j] = arr[len(arr)-1-j]
		arr[len(arr)-1-j] = temp
	print(' '.join(arr))	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'

n = eval(input());
i=0
while i<n:
	s = input()
	p = s.split()
	j=0
	while j<(len(p)/2):
		k = p[j]
		p[j] = p[len(p)-1-j];
		p[len(p)-1-j] = k;
		j+=1
	print(" ".join(p))
	i+=1


# encoding=utf-8
'''
Created on 2015?8?12?

@author: limw
'''

t = eval(input())

for _ in range(t):
	ss = input().strip().split(' ')
	ss1 = ss[::-1]
	for l in ss1:
		print(l, end=' ')
	print()


t = int(input());
for i in range(t):
	l = input().split();
	l.reverse();
	print(" ".join(l));


t=eval(input())
while t>0:
	a=input()
	t=t-1
	a=a.split(' ')
	temp=''
	
	if len(a)%2==0:
		for i in range(0,len(a)/2):
			print(a[len(a)-i-1], end=' ')
		for i in range(1,len(a)/2+1):
			print(a[len(a)/2 - i], end=' ')
	else:
		for i in range(0,len(a)/2):
			print(a[len(a)-i-1], end=' ')
		print(a[len(a)/2], end=' ')
		for i in range(1,len(a)/2+1):
			print(a[len(a)/2 - i], end=' ')
	print('')
		
	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

n=int(input())
while(n>0):
	s=input()
	print(' '.join((s.split(' '))[::-1]))
	n-=1


n=int(input())
while(n!=0):
	n-=1
	str1=input().split(" ")
	rev=str1[::-1]
	print(" ".join([str(item) for item in rev]))
	


t=eval(input())
for i in range(t):
	s=input()
	f=s.split(" ")
	for j in range(len(f)-1):
		f[len(f)-j-2]=f[len(f)-j-1]+" "+f[len(f)-j-2]
		if(j==len(f)-2):
			print(f[len(f)-j-2])