In this problem the input will consist of a number of lines of English text consisting of the letters of the English alphabet, the punctuation marks ' (apostrophe), . (full stop), , (comma), ; (semicolon), :(colon) and white space characters (blank, newline). Your task is print the words in the text in reverse order without any punctuation marks.
For example consider the following candidate for the input text:
$ $
This is a sample piece of text to illustrate this 
problem.  If you are smart you will solve this right.

$ $
The corresponding output would read as:
$ $
right this solve will you smart are you If problem
this illustrate to text of piece sample a is This

$ $
That is, the lines are printed in reverse order and in each line the words are printed in reverse order.

-----Input:-----
The first line of input contains a single integer $N$, indicating the number of lines in the input. This is followed by $N$ lines of input text.

-----Output:-----
$N$ lines of output text containing the input lines in reverse order and where each line contains the words in reverse order as illustrated above.

-----Constraints:-----
- $1 \leq N \leq 10000$.
- There are at most $80$ characters in each line

-----Sample input-----
2
This is a sample piece of text to illustrate this 
problem.  If you are smart you will solve this right.

-----Sample output-----
right this solve will you smart are you If problem
this illustrate to text of piece sample a is This

Difficulty: UNKNOWN_DIFFICULTY

Starter code:

Solutions:
N = int(input())
l = []
for i in range(N):
	l.append(input())
for j in range(N - 1, -1, -1):
	s = '` ' + l[j]
	n = len(s) - 1
	y = s[n]
	f = ''
	while y != '`':
		w = ''
		while y != ' ':
			if ord(y) in range(97, 123) or ord(y) in range(65, 91):
				w += y
			n -= 1
			y = s[n]
		wf = ''
		n -= 1
		y = s[n]
		x = len(w)
		for k in range(x):
			wf += w[x - k - 1]
		f += wf + ' '
	print(f)


def ff(z):
	x = ''
	l = ['.', '!', ',', ';', ':', '\n', "'", '  ']
	for i in str(z):
		if i not in l and (ord(i) != 32 or ord(i) != 10):
			x += i
	x = x.replace('  ', ' ')
	x = x.split(' ')
	return ' '.join(reversed(x))
n = int(input())
li = []
while n:
	n -= 1
	li.append(ff(input()))
i = len(li) - 1
while i > -1:
	print(li[i])
	i -= 1


arr = []
n = int(input())
for T in range(n):
	s = list(input().split())
	arr.append(s)
arr.reverse()
for i in arr:
	i.reverse()
	for j in i:
		if j.isalpha():
			print(j, end=' ')
		else:
			print(j[:len(j) - 1], end=' ')
	print()


bad_char = ["'", '.', ',', ';', ':']
intial = []
for _ in range(int(input())):
	intial.append(input().split(' '))
for line in reversed(intial):
	for i in reversed(line):
		if i.isalpha():
			print(i, end=' ')
		else:
			for j in bad_char:
				i = i.replace(j, '')
			print(i, end=' ')
	print(end='\n')


import re
n = int(input(''))
m = n - 1
lst = list()
while n > 0:
	tmp = re.sub('[^\\w\\s]', '', input('')).split()
	lst.append(tmp[::-1])
	n = n - 1
while m >= 0:
	print(*lst[m], sep=' ')
	m = m - 1


def REPLACE(string, par):
	return ''.join(string.split(par))
out = []
n = int(input())
for _ in range(n):
	s = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(input(), ';'), ':'), ','), '.'), "'")
	out.append(' '.join(s.split()[::-1]))
print(''.join([out[n - (i + 1)] + '\n' for i in range(n)]))


import re
new_list = []
for _ in range(int(input())):
	s = re.sub('[^\\w\\s]', '', input())
	new_list.append(s.split()[::-1])
for val in new_list[::-1]:
	print(' '.join(val))


import re
n = int(input())
b = []
for i in range(n):
	a = re.sub('[^\\s\\w]', '', input()).split()
	b.append(' '.join(a[::-1]))
for i in b[::-1]:
	print(i)


n = int(input())
final = []
for temp in range(n):
	s = input()
	res = ''
	for i in range(len(s)):
		if s[i] >= 'a' and s[i] <= 'z' or (s[i] >= 'A' and s[i] <= 'Z') or s[i] == ' ':
			res += s[i]
	res = res.split(' ')
	res = res[::-1]
	res = ' '.join(res)
	final.append(res)
x = len(final)
while x > 0:
	x = x - 1
	print(final[x])


n = int(input())
s = []
for x in range(n):
	a = input()
	a = ' '.join(a.split()[::-1])
	pun = ".,:;'"
	b = ''
	for i in a:
		if i not in pun:
			b += i
	s.append(b)
n = s[::-1]
for i in n:
	print(i)


import re
n = int(input())
line = ''
lines = []
for i in range(n):
	line = input()
	line = re.sub("[\\.,\\';:]+", '', line)
	line = re.sub('\\s+', ' ', line)
	lines.append(line.split()[::-1])
lines.reverse()
for i in range(n):
	for j in range(len(lines[i])):
		if j < len(lines[i]):
			print(lines[i][j], '', end='')
	print()


n = int(input())
ans = []
for x in range(n):
	a = input()
	a = ' '.join(a.split()[::-1])
	punctuation = ".,:;'"
	b = ''
	for i in a:
		if i not in punctuation:
			b += i
	ans.append(b)
n = ans[::-1]
for i in n:
	print(i)


n = int(input())
a = []
for i in range(n):
	a.append(input().split())
for i in range(int(n / 2)):
	(a[i], a[n - i - 1]) = (a[n - i - 1], a[i])
for i in range(n):
	ln = len(a[i]) / 2
	for j in range(int(ln)):
		(a[i][j], a[i][len(a[i]) - j - 1]) = (a[i][len(a[i]) - j - 1], a[i][j])
for i in range(n):
	for j in range(len(a[i])):
		for k in a[i][j]:
			if not (k >= 'a' and k <= 'z' or (k >= 'A' and k <= 'Z') or (k >= '0' and k <= '9')):
				a[i][j] = a[i][j][:len(a[i][j]) - 1]
for i in range(n):
	for j in range(len(a[i])):
		if j == len(a[i]) - 1:
			print(a[i][j])
		else:
			print(a[i][j], end=' ')


res = []
for i in range(int(input())):
	n = input()
	x = list(n)
	re = ''
	for i in x:
		if i == "'" or i == ';' or i == ',' or (i == ':') or (i == '.'):
			continue
		else:
			re += i
	t = []
	p = ''
	p1 = len(re)
	i = 0
	while i < p1:
		if re[i] in 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ':
			p += re[i]
			i += 1
		elif re[i] == ' ':
			try:
				while re[i] == ' ':
					i += 1
			except:
				break
			t.append(p)
			p = ''
	t.append(p)
	t = t[::-1]
	res.append(t)
res = res[::-1]
for i in res:
	print(*i)


import string
punc = ['.', "'", ',', ':', ';']
res = []
for _ in range(int(input())):
	s = input()
	for i in s:
		if i in punc:
			s = s.replace(i, '')
	s = s.split()
	res.append(s)
for i in range(len(res) - 1, -1, -1):
	print(' '.join(res[i][::-1]))


n = int(input())
arr = []
d = ["'", '.', ',', ';', ':']
for i in range(n):
	temp = input().strip()
	for j in d:
		if j in temp:
			temp = temp.replace(j, '')
	temp = temp.split()
	temp.reverse()
	arr.append(temp)
for i in range(len(arr) - 1, -1, -1):
	print(' '.join(arr[i]))