#C12637. 90-Degree Clockwise Matrix Rotation

    ID: 42086 Type: Default 1000ms 256MiB

90-Degree Clockwise Matrix Rotation

90-Degree Clockwise Matrix Rotation

You are given a square matrix of size n where each column is sorted in ascending order. Your task is to rotate the matrix 90 degrees clockwise.

The rotation formula is given by:

ai,jaj,n1ia_{i,j} \to a_{j, n-1-i}

Example:

Input:
4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16

Output: 13 9 5 1 14 10 6 2 15 11 7 3 16 12 8 4

</p>

Note: The input matrix is guaranteed to have each column sorted in ascending order, but this property is not required for performing the rotation.

inputFormat

The first line contains an integer n denoting the size of the matrix.

The following n lines each contain n space-separated integers representing the matrix rows.

All input is read from standard input (stdin).

outputFormat

Print the rotated matrix with 90-degree clockwise rotation. The output should consist of n lines, where each line contains n space-separated integers.

All output is written to standard output (stdout).

## sample
1
5
5

</p>