local h,w,k=io.read("n","n","n","l")
local cake={}
local counter=1
for i=1,h do
    local s=io.read()
    local strawberry=0
    for _,_ in s:gmatch("#") do
        strawberry=strawberry+1
    end
    cake[i]={}
    for j=1,w do
        if s:sub(j,j)~="#" then
            cake[i][j]=counter
        else
            cake[i][j]=counter
            strawberry=strawberry-1
            if strawberry>0 then
                counter=counter+1
            end
        end
    end
    counter=counter+1
end

for i=1,h do
    print(table.concat(cake[i]," "))
end