#K80202. Zigzag Matrix Fill

    ID: 35478 Type: Default 1000ms 256MiB

Zigzag Matrix Fill

Zigzag Matrix Fill

Given a positive integer \(n\) representing the number of rows, fill an \(n \times 10\) matrix with the integers from 1 to \(10n\) in a zigzag manner. For columns with even indices (starting from 0), fill the column from top to bottom, and for columns with odd indices, fill the column from bottom to top.

For example, if \(n=3\), the matrix should be:

\[ \begin{bmatrix} 1 & 6 & 7 & 12 & 13 & 18 & 19 & 24 & 25 & 30 \\ 2 & 5 & 8 & 11 & 14 & 17 & 20 & 23 & 26 & 29 \\ 3 & 4 & 9 & 10 & 15 & 16 & 21 & 22 & 27 & 28 \end{bmatrix} \]

Your task is to implement the solution and print the resulting matrix, where each row of the matrix is printed on a new line with the values separated by a single space.

inputFormat

The input consists of a single integer \(n\) (\(1 \leq n \leq 100\)) representing the number of rows.

outputFormat

Output the resulting matrix with \(n\) lines. Each line contains 10 space-separated integers which represent one row of the matrix.

## sample
1
1 2 3 4 5 6 7 8 9 10

</p>