Problem: Find an n × n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.

Input

The only line contains odd integer n (1 ≤ n ≤ 49).

Output

Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.

Examples

Input

1


Output

1


Input

3


Output

2 1 4
3 5 7
6 9 8

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Wolfgang Beyer
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            if (n == 1) {
                out.println(1);
                return;
            }
            int[][] m = new int[n][n];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    m[i][j] = 0;
                }
            }

            int center = n / 2;
            int even = 1;
            int odd = 0;
            for (int i = 0; i < n; i++) m[i][center] = 2 * odd++ + 1;
            //out(m);
            for (int i = 0; i < n; i++) {
                if (i != center) m[center][i] = 2 * odd++ + 1;
            }
            //out(m);

            for (int i = 1; i <= n / 2; i++) {

                //top left
                int col = center - i;
                int row = center - i;
                m[row][col] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                for (int j = col - 1; j >= 0; j--) {
                    m[row][j] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                }
                for (int j = row - 1; j >= 0; j--) {
                    m[j][col] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                }

                //top right
                col = center + i;
                row = center - i;
                m[row][col] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                for (int j = col + 1; j < n; j++) {
                    m[row][j] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                }
                for (int j = row - 1; j >= 0; j--) {
                    m[j][col] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                }

                //bottom left
                col = center - i;
                row = center + i;
                m[row][col] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                for (int j = col - 1; j >= 0; j--) {
                    m[row][j] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                }
                for (int j = row + 1; j < n; j++) {
                    m[j][col] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                }

                //bottom right
                col = center + i;
                row = center + i;
                m[row][col] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                for (int j = col + 1; j < n; j++) {
                    m[row][j] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                }
                for (int j = row + 1; j < n; j++) {
                    m[j][col] = (i % 2 == 0) ? 2 * odd++ + 1 : 2 * even++;
                }
            }

            output(m, out);



        /*for (int i = 1; i <= 49; i += 2) {
            System.out.print(i + ": ");
            int goal = (i * i) / 2;
            int start = (int) Math.floor(Math.sqrt(goal));
            if (start % 2 != 0) start--;
            for (int j = start; j > 0; j -= 2) {
                if (j * j <= goal) {
                    System.out.print((j * j) + ", ");
                    goal -= j * j;
                    j += 2;
                }
            }
            System.out.println("rest " + goal);
        }*/
        }

        void output(int[][] m, PrintWriter out) {
            int n = m.length;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    out.print(m[i][j] + " ");
                }
                out.println();
            }
        }

    }

    static class InputReader {
        private static BufferedReader in;
        private static StringTokenizer tok;

        public InputReader(InputStream in) {
            this.in = new BufferedReader(new InputStreamReader(in));
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            try {
                while (tok == null || !tok.hasMoreTokens()) {
                    tok = new StringTokenizer(in.readLine());
                }
            } catch (IOException ex) {
                System.err.println("An IOException was caught :" + ex.getMessage());
            }
            return tok.nextToken();
        }

    }
}