H, W = gets.split.map(&:to_i) S = H.times.map { gets.chomp } counter_y = Array.new(H, 0) counter_x = Array.new(W, 0) points = [] H.times do |y| W.times do |x| next if S[y][x] == '-' points << [y, x] counter_y[y] += 1 counter_x[x] += 1 end end H.times do |y| next if counter_y[y] != 1 W.times do |x| next if counter_x[x] != 1 next if S[y][x] == '*' S[y][x] = '*' puts S exit end end dy = points[1][1] - points[0][1] dx = points[1][0] - points[0][0] H.times do |y| next if counter_y[y] == 2 W.times do |x| next if counter_x[x] == 2 next if S[y][x] == '*' next if points[0][1] - dy == y && points[0][0] - dx == x next if points[1][1] + dy == y && points[1][0] + dx == x S[y][x] = '*' puts S exit end end