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.*;
import java.util.*;
import java.math.*;
public class Solve3 {
  static int isOk(int[][] t, int n, int miss[]) {
    int count = 0;
    int e = 0;
    int f = 0;
    for(int i = 0; i < n; i++) {
      int c = 0; 
      int d = 0;
      e += t[i][i];
      f += t[i][n-1-i];
      for(int j = 0; j < n; j++) {
        c += t[i][j];
        d += t[j][i];
      }
      if (c%2 == 0) {count++; miss[i]++;}
      if (d%2 == 0) {count++; miss[i]++;}
    }
    if (e%2 == 0) count++;
    if (f%2 == 0) count++;
    return count; 
  }
  public static void main(String[] args) {
  MyScanner scanner = new MyScanner();



  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
    int n = scanner.nextInt();
    int[][] t = new int[n][n];
    int it = 0;
    int ok = 1;
    while(ok > 0) {
      it = 0;
      t = new int[n][n];
    for(int i = 0; i < n*n; i++) {
      t[i%n][i/n] = i + 1;

    }
    Random random = new Random();
    int miss[] = new int[n];
    int max = 0;
    ok = isOk(t, n, miss);
    
    while(ok > 0 && it < 50000) {
      for(int i = 0; i < n; i++) if(miss[max] <= miss[i]) {
        if(random.nextDouble() < 0.95)
          max = i;
      }
      int x1 = random.nextInt(n);
      int y1 = random.nextInt(n);
      int x2 = random.nextInt(n);
      int y2 = random.nextInt(n);
      if(random.nextDouble() < 0.3) x1 = y1;
      if(random.nextDouble() < 0.3) x1 = n-1-y1;
      if(random.nextDouble() < 0.3) x1 = max;
      if(random.nextDouble() < 0.3) y1 = max;
      int a = t[x1][y1];
      int b = t[x2][y2];
      t[x1][y1] = b;
      t[x2][y2] = a;
      Arrays.fill(miss, 0);
      int ok2 = isOk(t,n, miss);
      if(ok > ok2) {
        ok = ok2;
      } else {
        if(n > 5) {
        t[x1][y1] = a;
        t[x2][y2] = b;
        }
      }
      it++;
      //if(it %1000 == 0)
      //System.out.println(ok);
    }
    }
    for(int i = 0; i < n; i++) {
      for(int j = 0; j < n; j++)
        out.print(t[i][j] + " ");
      out.println();
    }
    out.close();
  }

  public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;
 
      public MyScanner() {
         br = new BufferedReader(new InputStreamReader(System.in));
      }
 
      String next() {
          while (st == null || !st.hasMoreElements()) {
              try {
                  st = new StringTokenizer(br.readLine());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return st.nextToken();
      }
 
      int nextInt() {
          return Integer.parseInt(next());
      }
 
      long nextLong() {
          return Long.parseLong(next());
      }
 
      double nextDouble() {
          return Double.parseDouble(next());
      }
 
      String nextLine(){
          String str = "";
    try {
       str = br.readLine();
    } catch (IOException e) {
       e.printStackTrace();
    }
    return str;
      }

   }
}