#K58357. Rotate Grid 90 Degrees Clockwise

    ID: 30624 Type: Default 1000ms 256MiB

Rotate Grid 90 Degrees Clockwise

Rotate Grid 90 Degrees Clockwise

Given an (n \times n) grid (a square matrix) of integers, your task is to rotate the grid by 90° clockwise. In other words, the element at position ((i, j)) moves to ((j, n-1-i)).

For example, if the grid is:
1 2 3
4 5 6
7 8 9

Then the rotated grid is:
7 4 1
8 5 2
9 6 3

Please note: The input is provided via standard input (stdin) and the output should be printed to standard output (stdout).

inputFormat

The first line of input contains a single integer (n) representing the size of the grid. This is followed by (n) lines, each containing (n) space-separated integers representing the rows of the grid.

outputFormat

Output the rotated grid. Print (n) lines, where each line contains (n) space-separated integers representing the grid after a 90° clockwise rotation.## sample

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

8 5 2 9 6 3

</p>