print(t=gets()) while gets() if k=$_.index("K") print(" "*k+"a"*(t.index("T")-k+1)) else print(t) end end