#C14691. Swap Diagonals in Square Matrix

    ID: 44368 Type: Default 1000ms 256MiB

Swap Diagonals in Square Matrix

Swap Diagonals in Square Matrix

Given a square matrix M of size n × n, your task is to swap the elements on the main diagonal with those on the anti-diagonal. In other words, for each index \(i\) (where \(0 \leq i < n\)), swap \(M[i][i]\) with \(M[i][n-i-1]\).

After performing all the swaps, output the modified matrix in the same row-major order as the input.

inputFormat

The input begins with a single integer n (\(1 \leq n \leq 100\)), representing the size of the matrix.

Then follow n lines, each containing n space-separated integers representing a row of the matrix.

outputFormat

Output the modified matrix after swapping the main diagonal and the anti-diagonal. Each row of the matrix should be printed on a new line with the elements separated by a single space.

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

4 5 6 9 8 7

</p>