import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[][] ans = new int[N][N]; for (int i = 0; i < N / 2; ++i) { for (int j = 0; j < N / 2; ++j) { ans[i][j] = 2 * i * (N / 2) + 2 * j + 1; ans[i + N / 2][j + N / 2] = ans[i][j] + 1; ans[i][N - 1 - j] = ans[i][j] + 2 * (N / 2) * (N / 2); ans[i + N / 2][N / 2 - 1 - j] = ans[i + N / 2][j + N / 2] + 2 * (N / 2) * (N / 2); } } for (int i = 0; i < N; ++i) { for (int j = 0; j < N; ++j) { System.out.print(ans[i][j] + (j == N - 1 ? "\n" : " ")); } } } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }