시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 10 5 5 50.000%

문제

Oh how the cows love to walk in their square pasture with sides of length N (1 <= N <= 750) and which is partitioned into N*N squares. They enjoy the sights, the smells, and the general ambience of the grass and trees.

Bessie has decided to take the cows on the longest possible walk from the upper left corner to the center (or near the center when N is even) of the pasture, passing through each and every square along the way after starting.

She has decided to create the obvious clockwise spiral route (example below) for this evening's stroll. Write a program to create a map for her that shows the order of squares she should visit.

By way of example, for pastures of size N=3 and N=4, here are the routes Bessie should use:

      1  2  3        1  2  3  4
      8  9  4       12 13 14  5
      7  6  5       11 16 15  6
                    10  9  8  7

입력

Line 1: A single integer: N

 

출력

Lines 1..N: N space-separated integers

 

예제 입력

3

예제 출력

1 2 3
8 9 4
7 6 5

힌트