# 愚直にぐるぐるやるか、計算でやるか # N<30なので愚直にやってみるか N = int(input()) grid = [[-1]*N for i in range(N)] move = [[0, 1], [1, 0], [0, -1], [-1, 0]] i = 0 j = 0 count = 1001 grid[i][j] = str(count)[1:] count += 1 direction = 0 while True: moving = False while 0 <= i+move[direction][0] < N and 0 <= j+move[direction][1] < N and grid[i+move[direction][0]][j+move[direction][1]] == -1: i += move[direction][0] j += move[direction][1] grid[i][j] = str(count)[1:] count += 1 moving = True direction = (direction+1)%4 if moving == False: break #print(grid) for g in grid: print(*g)