import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    int H, W;
    readf("%d %d\n", &H, &W);
    auto N = readln.chomp.to!int;
    auto a = readln.split.to!(int[]);
    int color = 1;
    foreach (y; 0..H) {
        int[] res;
        while (res.length < W) {
            if (res.length + a.front <= W) {
                res ~= color.repeat(a.front).array;
                a.popFront;
                color++;
            } else {
                a.front -= W-res.length;
                res ~= color.repeat(W-res.length).array;
            }
        }
        auto str = res.map!(x => x.to!string).join(" ").dup;
        if (y % 2) reverse(str);
        str.writeln;
    }
}

