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.*;
public class Dfs {
    static class pair {
        int f;
        int s;
        pair(int x,int y){
            f=x;s=y;
 }
        
        
    }
    public static void main(String[] args)throws Exception {
     //Scanner in =new Scanner(System.in);
     BufferedReader in =new BufferedReader(new InputStreamReader(System.in));
    // StringTokenizer tok = new StringTokenizer(in.readLine());
    int n=Integer.parseInt(in.readLine());
    int arr[][] =  new int [n][n];
    StringBuilder str =  new StringBuilder();
    int x=n/2;int y=1;
    for(int i=0;i<n;i++){
        arr[i][x]=y;        
        y+=2;
    }
    for(int i= 0;i<n;i++)
        if(arr[x][i]==0){
            arr[x][i]=y;
            y+=2;
        }
        int z=(n*n+1)/2-(n+(n-1));    int j=0;int i= 0;int k=n-1;int m =n-1;int l=n-1;
 
        while (z>0){
            //System.out.println(z+" "+i+" "+j+" "+k+" "+m+" "+l);
            if(j!=k){
        arr[i][j]=y;y+=2;
        arr[i][k]=y;y+=2;
    
        arr[m][j]=y;y+=2;
        arr[l][k]=y;y+=2;
   
               }else{ 
                  k=n-1;j=0;i++; k=n-1;l--;  m--;continue;}
              
          z-=4; 
              j++;k--;
 }k=2;
        for(i= 0;i<n;i++)
            for(j=0;j<n;j++){
         
                if(arr[i][j]==0){
                    arr[i][j]=k;
                    k+=2;
                }
               
            }
        for(i= 0;i<n;i++){
            for(j =0;j<n;j++){
                str.append(arr[i][j]+" ");
            }
            str.append("\n");
        }
    
         System.out.println(str);   
          }}