Problem Description

Given r x c matrix, print all elements in spiral order.

Input Format

First line: r c. Next r lines: c integers.

Output Format

One line: spiral order.

Sample Test Case

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

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next