import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        try {
            Scanner in = new Scanner(new FileReader("F.in"));
            PrintWriter out = new PrintWriter(new FileWriter("F.out"));
            int n=in.nextInt();
            in.close();
            int m=n/2,k=n*n;
            int[][] a=new int[n][n];
            int sum=1;
            int i,j,state=0,h=1,f;
            j=m;
            i=m;
            a[i][j]=1;
            sum=2;
            while(a[i][j]!=n*n){
                if(state==0){
                    int l;
                    for(l=j+1;l<=((j+h<n)?j+h:n-1);l++)
                        a[i][l]=sum++;
                    j=--l;
                    state=1;
                    if(i==n-1)
                        break;
                }
                if(state==1){
                    int l;
                    for(l=i-1;l>=i-h;l--)
                        a[l][j]=sum++;
                    state=2;
                    i=++l;
                    h++;
                   
                }
                if(state==2){
                    int l;
                    for(l=j-1;l>=j-h;l--)
                        a[i][l]=sum++;
                    j=++l;
                    state=3;
                  
                }
                if(state==3){
                    int l;
                    for(l=i+1;l<=i+h;l++)
                        a[l][j]=sum++;
                    state=0;
                    i=--l;
                    h++;
                }
            }
            for(i=0;i<n;i++){
                for(j=0;j<n;j++)
                    out.print(a[i][j]+" ");
                out.println();
            }
	   out.close();
        }catch(Exception ex) {
            ex.printStackTrace();
        }        
    }
}
