hanuman-language

Hanuman has been a great admirer of Ram. However, there is one thing that Hanuman finds really difficult when talking to Ram. Hanuman can only understand sentences in reverse order but Ram,though an incarnation of God,is somehow unable to speak in reverse.
Help Ram by creating a program that will generate the sentence(string S) given by Ram in reverse order word by word.

INPUT:
An integer T (1 ≤ T ≤ 1000) : number of testcases
Each test case is represented by a sentence (1 ≤ length_of_sentence ≤ 100)

OUTPUT:
For each test case T, output a sentence which is in the reverse order of that of the user given sentence(word by word and not letter by letter) 

SAMPLE INPUT
3
I have always been fond of you, Hanuman
SpacelessSentence
A B C D 5

SAMPLE OUTPUT
Hanuman you, of fond been always have I
SpacelessSentence
5 D C B A

Source: hackerearth | Difficulty: EASY


Solutions:
noOfSentences = int(input())

def reverseString(s):
	strings = s.split(" ")
	strings = strings[::-1]
	return ' '.join(strings)

for caseNo in range(1, noOfSentences + 1):
	print(reverseString(input()))


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


import sys
n=eval(input());
for j in range(n):
	s=input();
	str=s.split();
	n=len(str);
	Print = sys.stdout.write
	for i in range(n-1,-1,-1):
		sys.stdout.write(str[i])
		sys.stdout.write(" ")
	print(" ");
	
	


T=int(input())
for i in range(T):
	words=input().split()
	p=len(words)
	for j in range(p):
		print(words[p-j-1], end=' ')
	print()


time = int(input())

for m in range(time):
	x = input()
	y = x.split()
	y.reverse()
	print(' '.join(y)," ")


c=int(input())
while(c!=0):
	a=input()
	a=a.split(' ')
	a.reverse()
	print((' '.join(a)))
	c-=1
	



noOfSentences = int(input())

def reverseString(s):
	strings = s.split(" ")
	strings = strings[::-1]
	return ' '.join(strings)

for caseNo in range(1, noOfSentences + 1):
	print(reverseString(input()))


tc = eval(input())
for etc in range(tc):
	myString = input()
	myList = myString.split()
	length = len(myList)
	for i in range(length):
		print(myList[length-i-1], end=' ')
	print()