import java.util.Scanner; public class Main { static int INF = 2 << 27; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[][] map = new int[N][N]; int x = 0; int y = 0; int v = 0; int[] vx = {1,0,-1,0}; int[] vy = {0,1,0,-1}; for(int i = 1; i <= N * N; i++) { map[y][x] = i; int tx = x + vx[v]; int ty = y + vy[v]; if(ty < 0 || tx < 0 || ty >= map.length || tx >= map[ty].length || map[ty][tx] != 0) v = (v + 1) % 4; x = x + vx[v]; y = y + vy[v]; } for(int i = 0; i < N; i++) { System.out.printf("%03d", map[i][0]); for(int j = 1; j < N; j++) { System.out.printf(" %03d", map[i][j]); } System.out.println(); } } }