CodeLab Academy 📞 9936 6696
← List Python · Level 8: Nested loops Code · 80 points ← #740 #742 →

#741. Matrix: Rotate 90° clockwise

You are given a matrix of integers. **Rotate 90° clockwise**. ### Input The first line has n m (the number of rows and columns), each of the next n lines has m integers. ### Output The answer.

Examples

Input
4 5
8 5 6 -4 4
-1 4 0 -1 5
1 -2 -7 7 9
-7 -8 1 4 7
Output
-7 1 -1 8
-8 -2 4 5
1 -7 0 6
4 7 -1 -4
7 9 5 4
Input
4 3
-8 -4 -3
7 8 -7
-1 -6 -6
7 2 4
Output
7 -1 7 -8
2 -6 8 -4
4 -6 -7 -3

💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!