import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); String[][] s = new String[n][n]; for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { s[i][j] = ""; } } int x = 0; int y = 0; int k = 2; int t = 0; s[y][x] = String.format("%03d", 1); int cnt = 0; while(k <= n * n) { // cnt++; // System.out.println(y + " " + x); // System.out.println(t); if(t == 0) { if(x + 1 < n) { if(s[y][x + 1].equals("")) { s[y][x + 1] = String.format("%03d", k); k++; x++; }else { t = 1; } }else { t = 1; } }else if(t == 1) { if(y + 1 < n) { if(s[y + 1][x].equals("")) { s[y + 1][x] = String.format("%03d", k); k++; y++; }else { t = 2; } }else { t = 2; } }else if(t == 2) { if(x - 1 >= 0) { if(s[y][x - 1].equals("")) { s[y][x - 1] = String.format("%03d", k); k++; x--; }else { t = 3; } }else { t = 3; } }else if(t == 3) { if(y - 1 >= 0) { if(s[y - 1][x].equals("")) { s[y - 1][x] = String.format("%03d", k); k++; y--; }else { t = 0; } }else { t = 0; } } } for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(j == n - 1) { System.out.println(s[i][j]); }else { System.out.print(s[i][j] +" "); } } } } }