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

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


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