input = gets.chomp.split(" ").map(&:to_i)

H = input[0]
W = input[1]
K = input[2]
dic = 1
copy_count = 0
res_line = Array.new(W)

H.times do
  line = gets.chomp.split("")
  res_line = Array.new(W)
  if line.index("#") == nil
    copy_count += 1
    next
  end
  

  line.each_with_index do |e,i|
    if e == "#" || i == (W - 1)
      res_line[i] = dic
      dic += 1
    elsif e == "."
      res_line[i] = dic
    end
  end
  copy_count += 1
  copy_count.times do
    puts res_line.join(" ")
  end
  copy_count = 0
end

if copy_count != 0
  copy_count.times do
    puts res_line.join(" ")
  end
end
