e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

Week 12: February 8 - 14

Rotation

The array of size n × m is given. Rotate it 90 degrees clockwise.

Input

The first line contains two integers n and m (1n, m50). Each of the next n lines contains m nonnegative integers, not greater than 109 - it is the array itself.

Output

Print the rotated array in the same format like input.

Time limit 1 second
Memory limit 128 MiB
Input example #1
3 4
1 2 3 4
5 6 7 8
9 10 11 12
Output example #1
4 3
9 5 1
10 6 2
11 7 3
12 8 4