We are to read and write a square matrix of integers. It is to be written with the standard layout but it is given to us differently, with disordered rows and omitting some of them.
Input
The first line of the input provides us with a nonnegative integer, the dimension n of the matrix. Then, the second line gives a nonnegative integer m indicating the number of row specifications provided explicitly along the next lines. Then we have m lines: in each of them, the first number i is always such that 1 ≤ i ≤ n and indicates that the line specifies row i; this number is followed by n integers that form indeed the i-th row of the matrix. No assumption can be made about the values i beyond what has been indicated. In case the same row index appears multiple times, only the last one is to be considered valid. Rows that are not explicitly specified are understood to consist only of zeros.
Output
The square matrix specified by the input, written row by row: the contents of row i is given by the last line starting by i in the input, if any, and is just zeros if no specification for that row appears in the input.
Input
3 2 3 1 2 3 1 3 4 5
Output
3 4 5 0 0 0 1 2 3
Input
2 0
Output
0 0 0 0
Input
4 2 4 1001 1002 1003 1004 2 2011 2012 2013 2014
Output
0 0 0 0 2011 2012 2013 2014 0 0 0 0 1001 1002 1003 1004
Input
2 3 1 5 6 2 3 4 2 7 8
Output
5 6 7 8
Input
1 5 1 7 1 6 1 5 1 4 1 3
Output
3