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.

Starter code:

Solutions:
# cook your dish here
x= int(input())
for i in range(x):
    y = list(map(str, input().split()))
    j= 0
    while j<len(y)-1:
        print((y[j][0]).capitalize()+".", end=' ')
        j+= 1
    print(y[len(y)-1].capitalize())

# cook your dish here
for _ in range(int(input())):
    s = input()
    l = s.split()
    l[-1] = l[-1].title()
    for i in range(len(l) - 1):
        l[i] = l[i][0].upper() + "."
    print(*l)

# cook your dish here
for t in range(int(input())):
    a=input().split()
    if len(a)==1:
        s=a[0].capitalize()
        print(s)
    else:
        for i in range(0,len(a)-1):
            a[i]=a[i].capitalize()
            print(a[i][0],end="")
            print(".",end=" ")
        a[-1]=a[-1].capitalize()
        print(a[-1],end="")
        print("\r")

t=int(input())
for i in range(t):
    s=input().split()
    res=""
    for i in range(len(s)):
        s[i]=s[i].capitalize()
    if(len(s)==1):
        res=res+s[0]
    elif(len(s)==2):
        k=s[0]
        res=res+k[0]+". "+ s[1]
    elif(len(s)==3):
        l=s[0]
        m=s[1]
        res=res+l[0]+". "+m[0]+". "+ s[2]
    print(res)
        

for _ in range(int(input())):
    name = input().split()

    if len(name) == 3:  print(f"{name[0][0].upper()}. {name[1][0].upper()}. {name[2].title()}")
    elif len(name) == 2:    print(f"{name[0][0].upper()}. {name[1].title()}")
    else:   print(name[0].title())

for i in range(int(input())):
    n=input().split()
    if len(n)==1:
        t=n[0]
        print(t.capitalize())
    else:
        for i in n:
            if i!=n[-1]:
                t=i.capitalize()
                print(t[0],'.',sep='',end=' ')
            else:
                print(i.capitalize())

t=int(input())
for i in range(t):
    n=input().split()
    if len(n)==1:
        a=n[0]
        print(a.capitalize())
    else:
        for i in n:
            if i!=n[-1]:
                a=i.capitalize()
                print(a[0],'.',sep='',end=' ')
            else:
                print(i.capitalize())

# cook your dish here
t=int(input());
A=0
for i in range(t):
    s=input().lower();
    c=0;
    e='';
    for i in range(len(s)):
        if s[i]==' ':
            c=c+1;
    #print(c);
    for i in range(len(s)):
        if c==0:
            print(s[0].upper()+s[1:]);
            break;
        elif c==1:
            if s[i]==' ':
                print(s[0].upper()+'.'+' '+s[i+1].upper()+s[i+2:]);
                break;
        elif c==2:
            if s[i]==' ':
                A=i;
                #print(A)
                f=s[i+1].upper();
                e=e+f;
        
    if c==2:
        print(s[0].upper()+'.'+' '+e[0]+'.'+' '+e[1]+s[A+2:]);
           
           
                
                
                
                
                
                
    
        
        


# cook your dish here
t=int(input())
for _ in range(t):
    name=input()
    name.lower()
    list_nm=name.split()
    k=len(list_nm)
    
    if(k==1):
        print(name.title())
    else:
        
        

        for i in list_nm[:k-1]:
            print(i[:1].title()+ '.',end=' ')
        print(list_nm[k-1].title())


# cook your dish here
t = int(input())
for z in range(t) :
    s = input().split()
    if len(s)==1 :
        x = s[0]
        print(x.capitalize())
    else:
        for i in s:
            if i != s[-1] :
                x = i.capitalize()
                print(x[0],'.',sep='',end=' ')
            else:
                print(i.capitalize())

# cook your dish here
t=int(input())
def do():
    s=input()
    c=0
    v=' '
    c=s.count(v)
    if c==0:
        s=s.capitalize()
        print(s)
    elif(c==1):
        f=s.split()[0]
        l=s.split()[1]
        l=l.capitalize()
        print(f[0].capitalize(),'. ',l,sep='')
    elif(c==2):
        f=s.split()[0]
        m=s.split()[1]
        l=s.split()[2]
        l=l.capitalize()
        print(f[0].capitalize(),'. ',m[0].capitalize(),'. ',l,sep='')
    else:
        pass
    return
for i in range(t):
    do()
        


t=int(input())
for i in range(t):
    s=[]
    s=input().split()
    for j in range(len(s)):
        s[j]=s[j].capitalize()
    for j in range(len(s)-1):
        print(s[j][0],end='')
        print('.',end=' ')
    print(s[-1])
        

# cook your dish here
try:
    for _ in range(int(input())):
        string = input()
        string = string.lower()
        stringd = ""
        t = 0
        for i in range(len(string)):
            t = 0
            if i == 0 or string[i-1] == " ":
                stringd = stringd + string[i].capitalize()
                t+=1
                a = i+1
            if " " in string[i:] and t == 1:
                stringd = stringd+"."+" "
        for i in string[a:]:
            stringd = stringd + i
        print(stringd)
except:
    pass

# cook your dish here
for _ in range(int(input())):
    n=[i for i in input().split()]
    c=""
    for i in n:
        if i==n[-1]:
           c+=i.capitalize()
        else:
            v=i.capitalize()
            c+=v[0]+'. '
            
    print(c)

for i in range(int(input())):
    l=list(input().split())
    tot=""
    if(len(l)==1):
        for j in l:
            print(j.capitalize())
    elif len(l)==2:
        j=l[0]
        tot+=j[0].capitalize()+". "
        tot+=l[1].capitalize()
    elif len(l)==3:
        j=l[0]
        k=l[1]
        tot+=j[0].capitalize()+". "
        tot+=k[0].capitalize()+". "
        tot+=l[2].capitalize()
    print(tot)


# cook your dish here
for i in range(int(input())):
    l=list(input().split())
    tot=""
    if(len(l)==1):
        for j in l:
            print(j.capitalize())
    elif len(l)==2:
        j=l[0]
        tot+=j[0].capitalize()+". "
        tot+=l[1].capitalize()
    elif len(l)==3:
        j=l[0]
        k=l[1]
        tot+=j[0].capitalize()+". "
        tot+=k[0].capitalize()+". "
        tot+=l[2].capitalize()
    print(tot)

# cook your dish here
for _ in range(int(input())) :
    name = input().split()
    
    if len(name) == 3 :
        print((name[0])[0].upper(),'.', sep="", end = " ")
        print((name[1])[0].upper(),'.', sep="", end = " ")
        print(name[2].capitalize())
        
    elif len(name) == 2 :
        print((name[0])[0].upper(),'.', sep="", end = " ")
        print(name[1].capitalize())
    
    else :
         print(name[0].capitalize())

T=int(input())
for _ in range(T):
    name = list(map(str,input().split()))
    proper_name=''
    for i in range(len(name)-1):
        proper_name=proper_name+name[i][0].upper()+'. '
    proper_name=proper_name+name[-1][0].upper()+name[-1][1:].lower()
    print(proper_name)
    

t = int(input())
for i in range(t):
    name = input()
    n_names = name.split(' ')
    res = ''
    if (len(n_names) == 3):
        res += n_names[0][0].upper()+". "+n_names[1][0].upper()+". "+n_names[2].capitalize()
    elif (len(n_names) == 2):
        res += n_names[0][0].upper()+". "+n_names[1].capitalize()
    else:
        res += n_names[0].capitalize()
    print(res)