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 (1 ≤ n, m ≤ 50). 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 as input.
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