CodeLab Academy 📞 9936 6696
← List Python · Level 10: Algorithms Code · 100 points ← #925 #927 →

#926. Spiral reading

Print the elements of the matrix on one line, going in a clockwise spiral that starts at the top-left. ### Input n m, then n lines of the matrix. ### Output One line.

Examples

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

💡 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!