a,*b,c=open(0) i=a.find("T") x=a for l in b:x+=a j=c.find("K") print(x+" "*j+"K"+"*"*(i-j))