#include<iostream> using namespace std; int main() { int n; int a[100][100]; int i,j,t; while(1) { cin >> n; memset(a,0,sizeof(a)); t = a[1][n] = 1; int x = 1,y=n; while(t<n*n) { while(x<n&&!a[x+1][y]) a[++x][y] = ++t; while(y>1&&!a[x][y-1]) a[x][--y] = ++t; while(x>1&&!a[x-1][y]) a[--x][y] = ++t; while(y<n&&!a[x][y+1]) a[x][++y] = ++t; } for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { cout << a[i][j] << " "; } cout << endl; } } return 0; }