Problem: 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.

Constraints

* 1 ≤ H, W ≤ 100
* 1 ≤ N ≤ H W
* a_i ≥ 1
* a_1 + a_2 + ... + a_N = H W

Input

Input is given from Standard Input in the following format:


H W
N
a_1 a_2 ... a_N


Output

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.

Examples

Input

2 2
3
2 1 1


Output

1 1
2 3


Input

3 5
5
1 2 3 4 5


Output

1 4 4 4 3
2 5 4 5 3
2 5 5 5 3


Input

1 1
1
1


Output

1

Solution (in JAVA):

Solution:
/*
* @Author Silviase(@silviasetitech)
* For ProCon
*/

import java.util.*;
import java.lang.*;
import java.math.*;

public class Main{

        static int MOD = (int)1e9+7;

        // for dfs
        static int n;
        static int ansi;
        static int[] w;
        static int[] ww;
        static boolean[] isvisited;
        //
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int h = sc.nextInt();
        int w = sc.nextInt();
        int n = sc.nextInt();
        int[] col = new int[n];
        int[][] grcol = new int[h][w];
        int pivot = 0;
        for (int i = 0; i < n; i++) {
            col[i] = sc.nextInt();
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (i % 2 == 0) {
                    // 0 -> w-1
                    if (col[pivot] == 0) {
                        pivot++;
                    }
                    col[pivot]--;
                    grcol[i][j] = pivot+1;
                }else{
                    // w-1 -> 0
                    if (col[pivot] == 0) {
                        pivot++;
                    }
                    col[pivot]--;
                    grcol[i][w-1-j] = pivot+1;
                }
            }
        }

        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                System.out.print( grcol[i][j] + " ");
            }
            System.out.println("");
        }


        sc.close();
    }

    /*
    For Numeric Analysis
    */
    public static int ManhattanDist(int x, int y, int xx, int yy) {
        return(Math.abs(xx-x) + Math.abs(yy-y));
    }

    public static double FuncOfx(double x, int funcnum) {
        switch (funcnum) {
            case 1:
                return x*x;

            case 2:
                return Math.exp(-1*x)-x*x;
        
            default:
                throw new IllegalArgumentException("Such Func doesn't Exist.");
        }
            
    }

    public static void Nibutan(double target, int funcnum) {
        int callcounter = 0;
        double lowbound = Integer.MIN_VALUE;
        double highbound = Integer.MAX_VALUE;
        double pivot = (lowbound + highbound)/2;
        double tmp;
        double tmp4swap;
        if (funcnum == 1) {
            lowbound = 0;
            pivot = (lowbound+highbound)/2;
        }
        while (true) {
            callcounter++;
            if (FuncOfx(highbound, funcnum) < FuncOfx(lowbound, funcnum)) {
                tmp4swap = highbound;
                highbound = lowbound;
                lowbound = tmp4swap;
            }

            if (FuncOfx(pivot,funcnum) > target) {
                System.out.println(String.format("%2d", callcounter) + ": " 
                            + String.format("%.6f", pivot) + " f(" + String.format("%.6f", pivot) +") is " 
                            + String.format("%.6f",FuncOfx(pivot,funcnum))  + ", so too high :(");
                tmp = (lowbound + pivot)/2;
                if ( Math.abs(tmp-pivot) < 0.00005 ) {
                    System.out.println("Found!" +String.format("%.3f", tmp)+" is the answer.");
                    return;
                }
                highbound = pivot;
                pivot = tmp;
            }else if(FuncOfx(pivot,funcnum) < target){
                System.out.println(String.format("%2d", callcounter) + ": " 
                            + String.format("%.6f", pivot) + " f(" + String.format("%.6f", pivot) +") is " 
                            + String.format("%.6f",FuncOfx(pivot,funcnum))  + ", so too high :(");
                tmp = (highbound + pivot)/2;
                if ( Math.abs(tmp-pivot) < 0.00005 ) {
                    System.out.println("Found!" +String.format("%.3f", tmp)+" is the answer.");
                    return;
                }
                lowbound = pivot;
                pivot = tmp;
            }
        }
        
    }

    /*
    Numeric Analysis End
    */

    private static long[][] CombinationLong_nCk(long n, long k) {
        n++; k++;
        long[][] ans = new long[(int)n][(int)k];
        for (int i = 0; i < n; i++) {
            ans[i][0] = 1;
        }
        for (int i = 0; i < n-1; i++) {
            for (int j = 0; j < k-1; j++) {
                if (i < j) {
                    ans[i][j] = 0;
                }else{
                    ans[i+1][j+1] = ans[i][j] + ans[i][j+1];
                }
            }
        }
        return ans;
    }

        public static int gcd_int(int a, int b) {
        
            if (a < b) {
                int tmpp = a;
                a = b;
                b = tmpp;
            }
            if (b == 0) {
                return a;
            }else{
                return gcd_int(b, a%b);
            }
        } 

        public static long gcd_long(long a, long b) {
        
            if (a < b) {
                long tmpp = a;
                a = b;
                b = tmpp;
            }
            if (b == 0) {
                return a;
            }else{
                return gcd_long(b, a%b);
            }
        }

        public static int lcm_int(int a, int b) {
            int gcd = gcd_int(a,b);
            return a/gcd*b;
        }

        public static long lcm_long(long a, long b) {
            long gcd = gcd_long(a,b);
            return a/gcd*b;
        }

        public static void dfs(int placenow) {
            // if went all -> success! 
            // if not went all -> fail...
            
            /*
            dfs    
            Go All Place that there is wayto to and not having been yet. 

             if island 1 is start point, dfs(1);
            if there is wayto to island 2 and island 3,
            - island 2 changes non-visited -> visited, and dfs(2).
            - island 3 changes non-visited -> visited, and dfs(3).
    
            */

            isvisited[placenow] = true;
            boolean success = true;
            for (int i = 0; i < n; i++) {
                if (isvisited[i] == false) { // not go all place
                    success = false;
                    break;
                }
            }
            if (success) {
                ansi++;
                isvisited[placenow] = false;
                return;
            }

            for (int i = 0; i < n; i++) {
                if (w[i] == placenow && isvisited[ww[i]] == false ) {
                    dfs(ww[i]);
                }else if(ww[i] == placenow && isvisited[w[i]] == false){
                    dfs(w[i]);
                }else{
                    continue;
                }
            }
            isvisited[placenow] = false;
            return;
        }

}