H, W = map(int, input().split()) ans_l =[] count = -1 flg = 0 for i in range(H): S = input() l = list(S) starcount = l.count("*") if starcount == 0: ans_l.append(S) elif starcount == 1: if l[0] == "*": S = S[0] + "*" + S[2:] ans_l.append(S) count = i break else: ans_l.append("*" + S[1:]) count = i break else: if i > 0: ans_l[-1] = "*" + ans_l[-1][1:] else: flg = 1 if count != -1: for i in range(H - count - 1): S = input() ans_l.append(S) if flg == 1: ans_l[-1] = "*" + ans_l[-1][1:] for li in ans_l: print(li)