Matrix printing

5

1 votes
Very-Easy
Problem

Given an NxN matrix. Print it in spiral form.

INPUT

First line contains N. Next is the NxN matrix.

OUTPUT

output in single line.

Constraints 1 <= N <= 10^3

Sample Input
4
1 2 3 4
5 6 7 8
9 10 11 12 
13 14 15 16
Sample Output
1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10
Time Limit: 0.5
Memory Limit: 256
Source Limit:
Editor Image

?