#B2107. Rotate Image by 90° Clockwise

    ID: 11189 Type: Default 1000ms 256MiB

Rotate Image by 90° Clockwise

Rotate Image by 90° Clockwise

Given a black and white image represented as a matrix with $n$ rows and $m$ columns, rotate the image 90° clockwise.

inputFormat

The first line contains two integers $n$ and $m$, which represent the number of rows and columns respectively. The following $n$ lines each contain $m$ space-separated integers (either 0 or 1) representing the pixels in the image.

outputFormat

Output the rotated image. After a 90° clockwise rotation, the resulting image has $m$ rows and $n$ columns. Each line should output the row of the rotated image with the numbers separated by a single space.

sample

3 3
1 0 0
0 1 0
0 0 1
0 0 1

0 1 0 1 0 0

</p>