program main
  implicit none
  integer :: n
  integer :: h, w
  integer, allocatable :: an(:)
  integer, allocatable :: masu(:)
  integer :: i, j, cnt

  read *, h, w
  read *, n

  allocate(an(n))
  allocate(masu(h*w))

  read *, an(1:n)

  cnt = 1
  do i = 1, n
    masu(cnt:cnt+an(i)-1) = i
    cnt = cnt + an(i)
  enddo

  do i = 1, h
    if(mod(i,2)==0)then
      print *, (masu(h*(i-1)+j),j = 1,w,1)
    else
      print *, (masu(h*(i-1)+j),j = w,1,-1)
    endif
  enddo

end program