h,w,k=gets.split.map(&:to_i)
m = h.times.map{gets.chomp}
last = nil
c = 0
head = 0
m.each do |l|
  cnt = l.count('#')
  if cnt == 0
    if last
      puts last
    else
      head += 1
    end
  else
    b = ''
    t = 0
    c += 1
    w.times do |j|
      t += 1 if l[j] == '#'
      c += 1 if l[j] == '#' && (1<t)
      b += '%d ' % c
    end
    puts b
    head.times{puts b} if head > 0
    head = 0
    last = b
  end
end
