H,W = map(int,raw_input().split(" ")) field = [] starts = [] for h in range(H): line = raw_input() field.append(line) for w in range(len(line)): if line[w] == "*": starts.append((w,h)) def nyrn(): global line for i in range(W): for j in range(H): flag = True for x,y in starts: if x == i or y == j: flag = False if flag: v = list(field[j]) v[i] = "*" field[j] = "".join(v) return i,j nyrn() for line in field: print line