h, w = gets.chomp.split.map(&:to_i)
answer = Array.new(h){Array.new(w, nil)}
h.times{|j|
    prev = nil
    gets.chomp.split("").each_with_index{|c, i|
        if c == "c"
            answer[j][i] = 0
            prev = 1
        else
            if prev
                answer[j][i] = prev
                prev += 1
            else
                answer[j][i] = -1
            end
        end
    }
}
answer.each{|ans| puts ans.join(" ")}
