i=input().find('T') while 1: d=input().find('K',print(' '*i+'*')) if d+1:-print(' '*d+'*'*(i-d+1))