
def solve(field, h, w)
  res = Array.new(h).map {Array.new(w, nil)}
  field.each.with_index do |row, i|
    k = -1
    row.each.with_index do |c, j|
      case c
      when "."
        if k == -1
          res[i][j] = -1
        else
          k += 1
          res[i][j] = k
        end
      when "c"
        res[i][j] = 0
        k = 0
      else
        fail
      end
    end
  end
  res.map {|row| row.join(" ") }.join("\n")
end

h, w = gets.split(" ").map(&:to_i)
field = []
h.times { field << gets.strip.chars }
puts solve(field, h, w)