#include<stdio.h>
int main(){
int n;
scanf("%d",&n);
int a[n][n]={0};
int x=0,y=(n+1)/2-1;
a[x][y]=1;
int count=1;
while(count<n*n-1){
count++;
if (x==0&&y!=n-1){
x=n-1;
y+=1;
a[x][y]=count;
}
else if(y==n-1&&x!=0){
y=0;
x-=1;
a[x][y]=count;
}
else if(x==0&&y==n-1){
x+=1;
a[x][y]=count;
}
else if(x!=0&&y!=n-1){
if(a[x-1][y+1]==0){
x-=1;
y+=1;
a[x][y]=count;
}
else{
x+=1;
a[x][y]=count;
}
}
}
for (int i=0;i<n;i++){
for (int j=0;j<n;j++){
printf("%d",a[i][j]);
if(j!=n-1){
printf(" ");
}
else{
printf("\n");
}
}
}
return 0;
}