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.*;
public class MatrizOdd
{
    public static void main(String[] args){
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int[] par=new int[(n*n)/2+1],impar =new int[(n*n)/2+1];
        for (int i=0;i<par.length;i++){
            par[i]=(i+1)*2;
            impar[i]=par[i]-1;
        }
        int ip=0;
        int ii=0;
        int[][] a= construir(n);
        for(int i=0;i<n;i++){
            for (int j=0;j<n;j++){
                if(a[i][j]==0){
                    a[i][j]=par[ip];
                    ip++;
                }
                else { 
                    a[i][j]=impar[ii];
                    ii++;
                }
                if(j==n-1)
                    System.out.print(a[i][j]+"\n");
                else System.out.print(a[i][j]+" ");
            }
        }
    }
    
    public static int[][] construir(int n){
        int[][] a= new int[n][n];
        a[n/2][n/2]=1;
        int ini=n/2;
        for(int j=0; j<ini;j++){
            for(int z=0;z<2;z++){
                int k=z*(n-j-1)+j*(1-z);
                for(int c=j;c<n-j;c++){
                    a[k][c]=(ini+c+1)%2;
                }
            }
            for(int z=0;z<2;z++){
                int c=z*(n-j-1)+j*(1-z);
                for(int k=j+1;k<n-j-1;k++){
                    a[k][c]=(ini+k+1)%2;
                }
            }
        }
        return a;
    }
}