#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vl; typedef pair pii; typedef pair pll; typedef int _loop_int; #define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i) #define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i) #define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i) #define DEBUG(x) cout<<#x<<": "< P; int n; int mp[35][35]; int d[] = {1,0,-1,0,1}; int main(){ scanf("%d",&n); REP(i,35)REP(j,35)mp[i][j] = 830252521; FOR(i,1,n+1)FOR(j,1,n+1)mp[i][j] = -1; int x=1,y=1; int dd=0; REP(i,n*n){ mp[x][y] = i+1; if(i==n*n-1)break; while(mp[x+d[dd]][y+d[dd+1]]>0)dd=(dd+1)%4; x += d[dd]; y += d[dd+1]; } REP(i,n){ REP(j,n){ printf("%03d",mp[j+1][i+1]); if(j