Score : $600$ points
Blocks are stacked in a triangle. The $i$-th column from the top has $i$ blocks.
You are given a sequence $P = ((a_1, c_1), (a_2, c_2), ..., (a_M, c_M))$ which is a result of the run-length compression of a sequence $A = (A_1, A_2, ..., A_N)$ consisting of non-negative integers less than or equal to $6$.
You will write a number on each block so that the following conditions are satisfied, where $B_{i,j}$ denotes the number to write on the $j$-th block from the left in the $i$-th column from the top:
Enumerate the numbers written on the blocks in the $K$-th column from the top.
Input is given from Standard Input in the following format:
$N$ $M$ $K$ $a_1$ $c_1$ $a_2$ $c_2$ $\vdots$ $a_M$ $c_M$
Print the answer in the following format. It is guaranteed that the answer is unique under the Constraint of the problem.
$B_{K,1}$ $B_{K,2}$ $\dots$ $B_{K,K}$
6 3 4 2 3 5 2 1 1
1 4 3 2
We have $A = (2,2,2,5,5,1)$. The number written on the blocks are as follows.
3 5 5 5 0 5 1 4 3 2 4 4 0 3 6 2 2 2 5 5 1
1 1 1 6 1
6
111111111 9 9 0 1 1 10 2 100 3 1000 4 10000 5 100000 6 1000000 0 10000000 1 100000000
1 0 4 2 5 5 5 6 3