local h,w=io.read("n","n")
local n=io.read("n")
local paint=""
for i=1,n do
    paint=paint..string.rep(tostring(i),io.read("n"))
end

local grid={}
for i=1,h do
    grid[i]={}
    for j=1,w do
        grid[i][j]=paint:sub(1,1)
        paint=paint:sub(2)
    end
end

for i=1,h do
    print(i%2==1 and table.concat(grid[i]," ") or string.reverse(table.concat(grid[i]," ")))
end