#C5958. Rotate a Square Matrix 90 Degrees Clockwise

    ID: 49664 Type: Default 1000ms 256MiB

Rotate a Square Matrix 90 Degrees Clockwise

Rotate a Square Matrix 90 Degrees Clockwise

You are given a square matrix of size \( n\times n \). Your task is to rotate the matrix by 90 degrees clockwise. Formally, if the original matrix is \( A = [a_{ij}] \), the rotated matrix \( B = [b_{ij}] \) is given by \( b_{ij} = a_{n-j+1,i} \) for \( 1 \leq i,j \leq n \).

The input will be provided via standard input (stdin) and the output should be printed via standard output (stdout). Each row of the rotated matrix must be printed on a separate line with elements separated by a single space.

If the matrix is empty (i.e., when \( n = 0 \)), your program should produce no output.

inputFormat

The first line contains an integer \( n \) representing the number of rows (and columns) of the square matrix. If \( n > 0 \), the following \( n \) lines each contain \( n \) integers separated by spaces, representing the rows of the matrix.

outputFormat

Output the rotated matrix (90 degrees clockwise). Each of the \( n \) lines should contain \( n \) integers separated by a space.

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

8 5 2 9 6 3

</p>