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.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        int n = Reader.nextInt();
        int[][] a = new int[n][n];
        int index = (n/2) ;
        int c = 1 ; 
        int even = 2 , odd = 1 ; 
        boolean is = false ;
        for (int i=0 ; i<n ; i++) {            
            for (int j=0 ; j<n ; j++) {
                if (!is) {
                  if (j==index) {
                        for (int k=0 ; k<c ; k++) {
                           a[i][j+k]=odd;
                            odd+=2;
                     }
                     j+=c-1;
                     c+=2;
                     index--;
                    }   
                }
                if (is) {
                    if (j==index) {
                        for (int k=0 ; k<c ; k++) {
                            a[i][j+k]=odd;
                            odd+=2;
                     }
                     j+=c-1;
                     c-=2;
                     index++;
                    }                      
                }                
                if (index==-1) {
                    is=true;                    
                    c=n-2;
                    index=1;
                }
            }
        }
        for (int i=0 ; i<n ; i++) {
            for (int j=0 ; j<n ; j++) {
                if (a[i][j]==0) {
                    a[i][j]=even; 
                    even+=2;
                }
                System.out.print(a[i][j]+" ");
            }
            System.out.println("");
        }
        
    }

}




    class Reader {

    static BufferedReader reader;
    static StringTokenizer tokenizer;

    public static int pars(String x) {
        int num = 0;
        int i = 0;
        if (x.charAt(0) == '-') {
            i = 1;
        }
        for (; i < x.length(); i++) {
            num = num * 10 + (x.charAt(i) - '0');
        }

        if (x.charAt(0) == '-') {
            return -num;
        }

        return num;
    }

    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    static void init(FileReader input) {
        reader = new BufferedReader(input);
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(
                    reader.readLine());
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return pars(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }
}