LearnPy Hub
← Arena
EasyRating 900

Snake Order

Print the matrix in snake order: first row left to right, second right to left, and so on, on one line.

Input

r c, then r lines.

Output

One line.

Sample 1

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

Sample 2

Input
1 2
1 2
Output
1 2
solution.py
Output appears here
Snake Order · Python Arena problem · LearnPy Hub