import core.bitop;
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.format;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
  auto hw = readln.chomp.split.map!(to!int);
  int h = hw.front;
  int w = hw.back;
  int n = readln.chomp.to!int;
  alias Node = Tuple!(int, "num", int, "color");
  int[] a = readln.chomp.split.map!(to!int).array;
  int index = 0;
  foreach (i; 0 .. h)
  {
    int[] line;
    int cnt = 0;
    while (cnt < w)
    {
      int v = a[index];
      int del = min(v, w - cnt);
      line ~= (index + 1).repeat.take(del).array;
      a[index] -= del;
      if (a[index] == 0) {
        ++index;
      }
      cnt += del;
    }
    if (i % 2)
    {
      // rev
      line = line.retro.array;
    }
    foreach (j, v; line)
    {
      if (j)
        write = " ";
      write = v;
    }
    writeln;
  }
}
