#C10169. Spiral Matrix Generator

    ID: 39344 Type: Default 1000ms 256MiB

Spiral Matrix Generator

Spiral Matrix Generator

Given a positive integer n, generate an n \(\times\) n spiral matrix where the elements from 1 to \(n^2\) are filled in spiral order. The spiral starts at the top-left corner and proceeds to the right, then down, left, and up, repeatedly until the whole matrix is filled.

Please read input from stdin and output the result to stdout as described below.

inputFormat

The input consists of a single positive integer n (\(1 \leq n \leq 100\)).

outputFormat

Output the spiral matrix with each row printed on a new line and the numbers in each row separated by a single space.

## sample
1
1