IntermediateRating 1200
Walk Around the Edge
Print the numbers on the border of the grid going clockwise, starting at the top-left corner.
Input
r and c, then r rows.
Output
One line.
Sample 1
Input
3 4 1 2 3 4 5 6 7 8 9 10 11 12
Output
1 2 3 4 8 12 11 10 9 5
Sample 2
Input
1 3 1 2 3
Output
1 2 3
Output appears here