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

public class Main{
  static int n;
  static boolean check(int x,int y){
    if (x>=n||y>=n) return false;
    if (x<0||y<0) return false;
    return true;
  }
  
  /*static void rec(int cur, int dir, int x, int y){
     if(cur==n*n+1) return;
     a[x][y] = cur;
     
     if (dir==0){//-->
       if (check(x-1,y)&&a[x-1][y]==0){
         rec(cur+1,1,x-1,y);
       }else if (check(x,y+1)){
         rec(cur+1,0,x,y+1);
       }
     }
     if(dir==1){//up
       if (check(x,y-1)&&a[x][y-1]==0){
         rec(cur+1,2,x,y-1);
       }else if (check(x-1,y)){
         rec(cur+1,1,x-1,y);
       }
     }if (dir==2){//<--
       if (check(x+1,y)&&a[x+1][y]==0){
         rec(cur+1,3,x+1,y);
       }else if (check(x,y-1)){
         rec(cur+1,2,x,y-1);
       }
     }
     if (dir==3){//down
       if (check(x,y+1)&&a[x][y+1]==0){
         rec(cur+1,0,x,y+1);
       }else if(check(x+1,y)){
         rec(cur+1,3,x+1,y);
       }
     }
     
  }*/
  
  public static void main(String args[])throws Exception{
    Scanner in = new Scanner(new File("F.in"));
    PrintWriter out = new PrintWriter(new File("F.out"));
    n = in.nextInt();
    int cur=1;
    int dir=3;
    int x=n/2;
    int y=n/2;
    int a[][] = new int[n][n];
    while(true){
      
      a[x][y] = cur;
      if (cur==n*n) break;
      //System.out.println(cur);
      if (dir==0){//-->
       if (check(x-1,y)&&a[x-1][y]==0){
        // rec(cur+1,1,x-1,y);
        cur++;
        dir=1;
        x--;
       }else if (check(x,y+1)){
         //rec(cur+1,0,x,y+1);
         cur++;
         dir=0;
         y++;
       }
       continue;
     }
     if(dir==1){//up
       if (check(x,y-1)&&a[x][y-1]==0){
         //rec(cur+1,2,x,y-1);
         cur++;
         dir=2;
         y--;
       }else if (check(x-1,y)){
         //rec(cur+1,1,x-1,y);
         cur++;
         dir=1;
         x--;
       }
       continue;
     }if (dir==2){//<--
       if (check(x+1,y)&&a[x+1][y]==0){
         //rec(cur+1,3,x+1,y);
         cur++;
         dir=3;
         x++;
       }else if (check(x,y-1)){
         //rec(cur+1,2,x,y-1);
         cur++;
         dir=2;
         y--;
       }
       continue;
     }
     if (dir==3){//down
       if (check(x,y+1)&&a[x][y+1]==0){
         //rec(cur+1,0,x,y+1);
         cur++;
         y++;
         dir=0;
       }else if(check(x+1,y)){
         //rec(cur+1,3,x+1,y);
         cur++;
         dir=3;
         x++;
       }
       continue;
     } 
    }
    for(int i=0;i<n;i++){
      for (int j=0;j<n;j++){
       out.print(a[i][j]+" ");
      }out.println();
    }
    out.close();
  }
}