#K80067. Spiral Matrix Generation

    ID: 35448 Type: Default 1000ms 256MiB

Spiral Matrix Generation

Spiral Matrix Generation

Given a positive integer \( n \), generate an \( n \times n \) matrix filled with elements from \( 1 \) to \( n^2 \) arranged in a clockwise spiral order. The numbers start at \( 1 \) and increase by one as they fill the matrix. For example, when \( n = 3 \), the resulting matrix is:

1 2 3
8 9 4
7 6 5

Your task is to read the value of \( n \) from standard input and print the corresponding spiral matrix to standard output.

inputFormat

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

outputFormat

Output the generated spiral matrix. Each row of the matrix should be printed on a new line with the numbers separated by a single space.

## sample
1
1