H,W=gets.split.map &:to_i M=$<.to_a a=[] H.times{|h|W.times{|w|M[h][w]==?*&&a<<[h,w]}} a,b=*a h,w=[[0,0],[1,0],[0,W-1]].find{|h,w|(a[0]-h)*(b[1]-w)-(b[0]-h)*(a[1]-w)!=0} M[h][w]=?* puts M