import java.util.Scanner; public class No401 { static Scanner sc = new Scanner(System.in); static int N = sc.nextInt(); static int masu[][] = new int[N][N]; public static void main(String[] args) { masu[0][0] = 1; int x = 0,y = 0; int houkou = 0; //0:→ 1:↓ 2:← 3:↑ for(int i = 2;i <= N*N;i++) { switch(houkou) { case 0: y++; if(y == N-1 || masu[x][y+1] != 0) { houkou = (houkou + 1) % 4; } break; case 1: x++; if(x == N-1 || masu[x+1][y] != 0) { houkou = (houkou + 1) % 4; } break; case 2: y--; if(y == 0 || masu[x][y-1] != 0) { houkou = (houkou + 1) % 4; } break; case 3: x--; if(masu[x-1][y] != 0) { houkou = (houkou + 1) % 4; } } masu[x][y] = i; } for(int i = 0;i < N;i++) { for(int j = 0;j < N;j++) { System.out.printf(String.format("%03d", masu[i][j]) + " "); } System.out.println(); } } }