Given a matrix, rotate the matrix 90 degrees clockwise.
Matrix:
1 2 3
4 5 6
7 8 9
After rotation:
7 4 1
8 5 2
9 6 3
Matrix:
1 2
3 4
5 6
After rotation:
5 3 1
6 4 2
The first line contains ‘T’ denoting the independent test cases.
For each test case, The first line contains the numbers 'n' and ‘m’ denoting the number of rows and columns respectively.
The next ‘n’ lines contains ‘m’ space-separated integers denoting elements of a 2-d matrix.
For each test case, It contains ‘m’ lines containing ‘n’ space-separated integers denoting the resultant matrix.
2
3 3
1 2 3
4 5 6
7 8 9
3 2
1 2
3 4
5 6
7 4 1
8 5 2
9 6 3
5 3 1
6 4 2
1
3 1
1
2
3
3 2 1
1 <= T <= 10
1 <= n,m <= 100
0 <= matrix[i][j] <= 100000