import java.util.Scanner; public class Main { public static void main(String[] args) { solver(); } static void solver() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[][] table = new int[n][n]; int d = 0; int now = 1; int x = 0, y = 0; int[] dx = { 1, 0, -1, 0 }; int[] dy = { 0, 1, 0, -1 }; while (true) { if (x >= n || y >= n) break; if (table[x][y] != 0) break; table[x][y] = now; now++; if (x + dx[d] >= n || y + dy[d] >= n || x + dx[d] < 0 || y + dy[d] < 0 || table[x + dx[d]][y + dy[d]] != 0) d = (d + 1) % 4; x += dx[d]; y += dy[d]; } for (int j = 0; j < n; j++) { for (int i = 0; i < n; i++) { System.out.printf("%03d" + (i == n - 1 ? "\n" : " "), table[i][j]); } } } }