height, width, num_ichigo = gets.split.map(&:to_i)
cake =[]
height.times { cake << gets.chop.chars }
p cake
ichigo_id = 0
cake.each.with_index do |line, h|
  line.each.with_index do |cell, w|
    if cake[h][w] == '#'
      ichigo_id += 1
      cake[h][w] = ichigo_id
    else
      cake[h][w] = ichigo_id
    end
  end
end