#C8244. Matrix Clockwise Rotation

    ID: 52205 Type: Default 1000ms 256MiB

Matrix Clockwise Rotation

Matrix Clockwise Rotation

This problem requires you to rotate a given (n \times n) matrix by 90° clockwise. You will be provided with one or more matrices as input. Each matrix is preceded by an integer specifying its dimension. Your task is to output the rotated matrix for each test case.

The rotation is defined by the formula: (A_{ij} \to A_{(n-j+1)i}), where (n) is the size of the matrix.

Note: Matrices are provided consecutively, and the input terminates with a line containing a single '-' character.

inputFormat

The input consists of multiple test cases. Each test case starts with an integer (n) (the size of the square matrix), followed by (n) lines, each containing (n) space-separated integers. The series of test cases ends with a line containing a single '-' character.

outputFormat

For each test case, output the rotated matrix with each row printed on a new line. Separate the output of different test cases with an empty line.## sample

3
1 2 3
4 5 6
7 8 9
-
7 4 1

8 5 2 9 6 3

</p>