#K3466. Reverse Rows of a Matrix
Reverse Rows of a Matrix
Reverse Rows of a Matrix
You are given a matrix with n rows and m columns. Your task is to reverse the order of the rows in the matrix. In other words, the first row becomes the last row, the second row becomes the second last row, and so on.
The input is provided via standard input (stdin) where the first line contains two space-separated integers n and m. The following n lines contain m integers each, representing the rows of the matrix. The output should be printed to standard output (stdout) in the same format: n lines with m space-separated integers per line representing the reversed matrix.
Note: All indices in this problem are 0-based as per conventional programming practices.
The LaTeX formulation for the reversal is given by: \(\text{Reversed Matrix} = [A_{n-1}, A_{n-2}, \dots, A_0]\), where \(A_i\) is the \(i\)-th row of the original matrix.
inputFormat
The input begins with a line containing two integers n and m separated by a space. Here, n is the number of rows and m is the number of columns. This is followed by n lines each containing m integers separated by spaces, representing the matrix.
outputFormat
Output the matrix after reversing the order of its rows. The output should consist of n lines, each containing m space-separated integers.
## sample3 3
1 2 3
4 5 6
7 8 9
7 8 9
4 5 6
1 2 3
</p>