n=0 t,k=0,0 while 1: n+=1 l=input() if 'T' in l: t=l.index('T') if 'K' in l: k=l.index('K') break print(' '*k,'*'*(t-k),'T',sep='') for i in range(n-1): print(' '*~-k,'*') print(' '*~-k,'K')