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.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

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

  static class TaskC {
    int n;
    int m;
    boolean[][] odd;

    public void solve(int testNumber, QuickScanner in, QuickWriter out) {
      n = in.nextInt();
      m = n >> 1;
      odd = new boolean[n][n];
      for (int i = 0; i < n; ++i) {
        odd[m][i] = odd[i][m] = true;
      }
      int rem = ((n * n + 1) >> 1) - (n << 1) + 1;
      if ((rem & 3) > 0) throw new RuntimeException();
      for (; rem > 0; rem -= 4) {
        fill();
      }
      int oddNumber = 1, evenNumber = 2;
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
          if (odd[i][j]) {
            out.printf("%d%c", oddNumber, j + 1 == n ? '\n' : ' ');
            oddNumber += 2;
          } else {
            out.printf("%d%c", evenNumber, j + 1 == n ? '\n' : ' ');
            evenNumber += 2;
          }
        }
      }
      if (oddNumber - 2 > n * n || evenNumber - 2 > n * n) throw new RuntimeException();
    }

    void fill() {
      for (int i = 0; i + 1 < n; ++i) {
        if (check(i, i)) {
          fill(i, i);
          return;
        }
        if (check(i, n - 1 - i - 1)) {
          fill(i, n - 1 - i - 1);
          return;
        }
      }
      for (int i = 0; i + 1 < n; ++i) {
        for (int j = 0; j + 1 < n; ++j) {
          if (check(i, j)) {
            fill(i, j);
            return;
          }
        }
      }
      throw new RuntimeException();
    }

    boolean check(int i, int j) {
      return !odd[i][j] && !odd[i + 1][j] && !odd[i][j + 1] && !odd[i + 1][j + 1];
    }

    void fill(int i, int j) {
      odd[i][j] = true;
      odd[i + 1][j] = true;
      odd[i][j + 1] = true;
      odd[i + 1][j + 1] = true;
    }

  }

  static class QuickScanner {
    private static final int BUFFER_SIZE = 1024;
    private InputStream stream;
    private byte[] buffer;
    private int currentPostion;
    private int numberOfChars;

    public QuickScanner(InputStream stream) {
      this.stream = stream;
      this.buffer = new byte[BUFFER_SIZE];
      this.currentPostion = 0;
      this.numberOfChars = 0;
    }

    public int nextInt() {
      int c = nextNonSpaceChar();
      boolean positive = true;
      if (c == '-') {
        positive = false;
        c = nextChar();
      }
      int res = 0;
      do {
        if (c < '0' || '9' < c) throw new RuntimeException();
        res = res * 10 + c - '0';
        c = nextChar();
      } while (!isSpaceChar(c));
      return positive ? res : -res;
    }

    public int nextNonSpaceChar() {
      int res = nextChar();
      for (; isSpaceChar(res) || res < 0; res = nextChar()) ;
      return res;
    }

    public int nextChar() {
      if (numberOfChars == -1) {
        throw new RuntimeException();
      }
      if (currentPostion >= numberOfChars) {
        currentPostion = 0;
        try {
          numberOfChars = stream.read(buffer);
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
        if (numberOfChars <= 0) {
          return -1;
        }
      }
      return buffer[currentPostion++];
    }

    public boolean isSpaceChar(int c) {
      return c == ' '
          || c == '\n'
          || c == '\r'
          || c == '\t'
          || c < 0;
    }

  }

  static class QuickWriter {
    private final PrintWriter writer;

    public QuickWriter(OutputStream outputStream) {
      this.writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public QuickWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void printf(String format, Object... objects) {
      writer.printf(format, objects);
    }

    public void close() {
      writer.close();
    }

  }
}