ss = input().split() h = int(ss[0]) w = int(ss[1]) x1 = -1 y1 = -1 x2 = -1 y2 = -1 for i in range(h): s = input() f = 0 for j in range(2): f = s.find("*",f) if f == -1: break else: if x1 == -1: x1 = f y1 = i f += 1 else: x2 = f y2 = i x3 = -1 y3 = -1 if x1 == x2: x3 = x1 + 1 if x3 == w: x3 = 0 y3 = y1 elif y1 == y2: x3 = x1 y3 = y1 + 1 if y3 == h: y3 = 0 else: x3 = x1 + 1 if x3 == w: x3 = 0 y3 = y1 for i in range(h): ans = "" for j in range(w): if (i == y3 and j == x3) or (i == y1 and j == x1) or (i == y2 and j == x2): ans += "*" else: ans += "-" print(ans)