#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
#include<vector>

using namespace std;

int a[111][111];

int main() {
	freopen("F.in","r",stdin);
	freopen("F.out","w",stdout);
	int N;
	scanf("%d",&N);
	int k=N*N;
	int l=1,d=N;
	while (k > 0) {
		for (int i=d; i >= l; i--)
			a[d][i]=k--;
		for (int i=d-1; i >= l; i--)
			a[i][l]=k--;
		for (int i=l+1; i <= d; i++)
			a[l][i]=k--;
		for (int i=l+1; i < d; i++)
			a[i][d]=k--;
		d--;
		l++;
	}

	for (int i=1; i <= N; i++) {
		for (int j=1; j <= N; j++)
			printf("%d ",a[i][j]);
		printf("\n");
	}	

	return 0;
}
