local h,w=io.read("n","n")
local n=io.read("n")
local grid={}
for i=1,n do
    local a=io.read("n")
    while a>0 do
        table.insert(grid,i)
        a=a-1
    end
end

for i=1,h do
    local g={}
    if i%2==1 then
        for j=1,w do
            g[j]=grid[j+w*(i-1)]
        end
    else
        for j=w,1 do
            g[j]=grid[j+w*(i-1)]
        end
    end
    print(table.concat(g," "))
end