Nitika was once reading a history book and wanted to analyze it. So she asked her brother to create a list of names of the various famous personalities in the book. Her brother gave Nitika the list. Nitika was furious when she saw the list. The names of the people were not properly formatted. She doesn't like this and would like to properly format it.
A name can have at most three parts: first name, middle name and last name. It will have at least one part. The last name is always present. The rules of formatting a name are very simple:

- Only the first letter of each part of the name should be capital.
- All the parts of the name except the last part should be represented by only two characters. The first character should be the first letter of the part and should be capitalized. The second character should be ".".

Let us look at some examples of formatting according to these rules:
- gandhi -> Gandhi

- mahatma gandhI -> M. Gandhi 
- Mohndas KaramChand ganDhi -> M. K. Gandhi 

-----Input-----
The first line of the input contains an integer T denoting the number of test cases.
The only line of each test case contains the space separated parts of the name.

-----Output-----
For each case, output the properly formatted name.

-----Constraints-----
- 1 ≤ T ≤ 100
- 2 ≤ Length of each part of the name ≤ 10
- Each part of the name contains the letters from lower and upper case English alphabets (i.e. from 'a' to 'z', or 'A' to 'Z')

-----Subtasks-----
Subtask #1 (40 points)
- There is exactly one part in the name.

Subtask #2 (60 points)
- Original constraints.

-----Example-----
Input:
3
gandhi
mahatma gandhI
Mohndas KaramChand gandhi

Output:
Gandhi 
M. Gandhi 
M. K. Gandhi 

-----Explanation-----
The examples are already explained in the problem statement.

Difficulty: EASY

Solutions:
for _ in range(int(input())):
	a = input().split()
	a[-1] = a[-1].lower().title()
	if len(a) > 1:
		for i in range(0, len(a) - 1):
			a[i] = a[i].replace(a[i], list(a[i])[0]).title()
			a[i] = a[i] + '.'
		for i in a:
			print(i, end=' ')
	else:
		print(a[0], end=' ')
	print()


for i in range(int(input())):
	s = input()
	l = []
	for i in s.split():
		l.append(i)
	k = 0
	l1 = []
	for i in l:
		if k != len(l) - 1:
			i = i.replace(i[:], i[0].capitalize() + '.', 1)
			l1.append(i)
		else:
			i = i.capitalize()
			l1.append(i)
		k += 1
	for i in l1:
		print(i, end=' ')
	print()