#K76917. Spiral Grid Generation

    ID: 34749 Type: Default 1000ms 256MiB

Spiral Grid Generation

Spiral Grid Generation

Given an integer \(N\), generate an \(N \times N\) grid filled with numbers from 1 to \(N^2\) in a clockwise spiral order.

Your task is to construct the spiral by starting at the top-left corner and filling the grid in the order of right, down, left, and up repeatedly until the entire grid is filled.

For example, when \(N = 3\), the output should be:

1 2 3
8 9 4
7 6 5

inputFormat

The input consists of a single integer \(N\) (\(1 \leq N \leq 100\)). This integer is provided via standard input.

outputFormat

Output the \(N \times N\) grid in which each row is printed on a separate line. The numbers in each row should be separated by a single space. The grid must represent the spiral filling order.

## sample
1
1