#include <bits/stdc++.h>
using namespace std;
int a[101][101];
int n,s=1,x=1,y=1;
int main(){
cin>>n;
a[1][1]=1;
while(s<n*n){
while(y+1<=n && a[x][y+1]==0){
y++;
s++;
a[x][y]=s;
}
while(x+1<=n && a[x+1][y]==0){
x++;
s++;
a[x][y]=s;
}
while(y-1>=1 && a[x][y-1]==0){
y--;
s++;
a[x][y]=s;
}
while(x-1>=1 && a[x-1][y]==0){
x--;
s++;
a[x][y]=s;
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
cout<<a[i][j]<<" ";
}
cout<<endl;
}
return 0;
}