{"raw_statement":[{"iden":"problem statement","content":"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:\n\n*   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$.\n*   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$.\n\nFind a way to paint the squares so that the conditions are satisfied. It can be shown that a solution always exists."},{"iden":"constraints","content":"*   $1 ≤ H, W ≤ 100$\n*   $1 ≤ N ≤ H W$\n*   $a_i ≥ 1$\n*   $a_1 + a_2 + ... + a_N = H W$"},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$H$ $W$\n$N$\n$a_1$ $a_2$ $...$ $a_N$"},{"iden":"sample input 1","content":"2 2\n3\n2 1 1"},{"iden":"sample output 1","content":"1 1\n2 3\n\nBelow is an example of an invalid solution:\n\n1 2\n3 1\n\nThis is because the squares painted in Color $1$ are not 4-connected."},{"iden":"sample input 2","content":"3 5\n5\n1 2 3 4 5"},{"iden":"sample output 2","content":"1 4 4 4 3\n2 5 4 5 3\n2 5 5 5 3"},{"iden":"sample input 3","content":"1 1\n1\n1"},{"iden":"sample output 3","content":"1"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}