#include<iostream> using namespace std; int main() { int a[20][20],n,i,j,k,x; cin>>n; x=1; for(k=1;k<=(n+1)/2;k++) { for(j=k;j<=n+1-k;j++) a[k][j]=x++; for(i=k+1;i<=n+1-k;i++) a[i][n+1-k]=x++; for(j=n-k;j>=k;j--) a[n+1-k][j]=x++; for(i=n-k;i>=k+1;i--) a[i][k]=x++; } for(i=1;i<=n;i++) { for(j=1;j<=n;j++) cout<<a[i][j]<<" "; cout<<endl; } return 0; }