H,W=(int(i) for i in input (). split ()) S=[input () for i in range (H)] C=0 i=0 P=[[0,0],[0,0]] while C<2: j=0 while j0: y=P[0][0]-1 else: y=P[0][0]+1 else: y=P[0][0] if P[0][1]>0: x=P[0][1]-1 else: x=P[0][1]+1 L=list(S[y]) L[x]="*" S[y]="".join(L) for i in range (H): print (S[i])