h, w = gets.split.map(&:to_i)

arr, ans = h.times.map{ gets.chomp.split("") }, h.times.map{ [-1] * w }

arr.each_index do |i|
  arr[i].each_index do |j|
    if arr[i][j] == "c"
      c = 0
      
      for k in j...w
        ans[i][k] = c
        c += 1
      end
    end
  end
end

ans.each do |elm|
  puts elm.join(" ")
end