output_description: Print one way to paint the squares that satisfies the conditions. Output in
  the following format:
  
      
      
      c_{1 1} ... c_{1 W}
      :
      c_{H 1} ... c_{H W}
      
  
  Here, c_{i j} is the color of the square at the i-th row from the top and j-th
  column from the left.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      H W
      N
      a_1 a_2 ... a_N
attempt: import sys
  
  
  ## io ##
  def IS():
      return sys.stdin.readline().rstrip()
  
  
  def II():
      return int(IS())
  
  
  def MII():
      return list(map(int, IS().split()))
  
  
  def MIIZ():
      return list(map(lambda x: x - 1, MII()))
  
  
  ## dp ##
  def DD2(d1, d2, init=0):
      return [[init] * d2 for _ in range(d1)]
  
  
  def DD3(d1, d2, d3, init=0):
      return [DD2(d2, d3, init) for _ in range(d1)]
  
  
  ## math ##
  def to_bin(x: int) -> str:
      return format(x, "b")  # rev => int(res, 2)
  
  
  def to_oct(x: int) -> str:
      return format(x, "o")  # rev => int(res, 8)
  
  
  def to_hex(x: int) -> str:
      return format(x, "x")  # rev => int(res, 16)
  
  
  MOD = 10**9 + 7
  
  
  def divc(x, y) -> int:
      return -(-x // y)
  
  
  def divf(x, y) -> int:
      return x // y
  
  
  def gcd(x, y):
      while y:
          x, y = y, x % y
      return x
  
  
  def lcm(x, y):
      return x * y // gcd(x, y)
  
  
  def enumerate_divs(n):
      """Return a tuple list of divisor of n"""
      return [(i, n // i) for i in range(1, int(n**0.5) + 1) if n % i == 0]
  
  
  def get_primes(MAX_NUM=10**3):
      """Return a list of prime numbers n or less"""
      is_prime = [True] * (MAX_NUM + 1)
      is_prime[0] = is_prime[1] = False
      for i in range(2, int(MAX_NUM**0.5) + 1):
          if not is_prime[i]:
              continue
          for j in range(i * 2, MAX_NUM + 1, i):
              is_prime[j] = False
      return [i for i in range(MAX_NUM + 1) if is_prime[i]]
  
  
  def prime_factor(n):
      """Return a list of prime factorization numbers of n"""
      res = []
      for i in range(2, int(n**0.5) + 1):
          while n % i == 0:
              res.append(i)
              n //= i
      if n != 1:
          res.append(n)
      return res
  
  
  ## libs ##
  from itertools import (
      accumulate as acc,
      combinations as combi,
      product,
      combinations_with_replacement as combi_dup,
  )
  from collections import deque, Counter
  from heapq import heapify, heappop, heappush
  from bisect import bisect_left
  
  
  # ======================================================#
  def pprint(c):
      for ci in c:
          print(*ci)
  
  
  def main():
      h, w = MII()
      n = II()
      aa = MII()
      aa = deque([i + 1 for i, a in enumerate(aa) for _ in range(a)])
      c = DD2(h, w)
      for i in range(h):
          for j in range(i, w - i):  # to right
              c[i][j] = aa.popleft()
          if not aa:
              break
          for k in range(i + 1, i + 1 + (h - 2 * (i + 1))):  # to down
              c[k][w - 1 - i] = aa.popleft()
          for j in reversed(range(i, w - i)):  # to left
              c[h - 1 - i][j] = aa.popleft()
          for k in reversed(range(i + 1, i + 1 + (h - 2 * (i + 1)))):  # to up
              c[k][i] = aa.popleft()
      for ci in c:
          print(*ci)
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  We have a grid with H rows and W columns of squares. Snuke is painting these
  squares in colors 1, 2, ..., N. Here, the following conditions should be
  satisfied:
  
    * For each i (1 ≤ i ≤ N), there are exactly a_i squares painted in Color i. Here, a_1 + a_2 + ... + a_N = H W.
    * For each i (1 ≤ i ≤ N), the squares painted in Color i are _4-connected_. That is, every square painted in Color i can be reached from every square painted in Color i by repeatedly traveling to a horizontally or vertically adjacent square painted in Color i.
  
  Find a way to paint the squares so that the conditions are satisfied. It can
  be shown that a solution always exists.
samples: [{"input": "2 2\n    3\n    2 1 1", "output": "1 1\n    2 3\n    \n\nBelow is an example of an invalid solution:\n\n    \n    \n    1 2\n    3 1\n    \n\nThis is because the squares painted in Color 1 are not 4-connected.\n\n* * *"}, {"input": "3 5\n    5\n    1 2 3 4 5", "output": "1 4 4 4 3\n    2 5 4 5 3\n    2 5 5 5 3\n    \n\n* * *"}, {"input": "1 1\n    1\n    1", "output": "1"}]