#include <iostream>
#include <cmath>
#include <fstream>
#include <sstream>
#include <set>
#include <vector>
#include <map>
#include <deque>
#include <stack>
#include <algorithm>
#include <string>
#include <time.h>

using namespace std;

int mas[102][102];

int main()
{
freopen("F.in", "r", stdin);
freopen("F.out", "w", stdout);
int n;
scanf("%d", &n);
for(int i=0; i<=n+1; i++)
	mas[i][0] = mas[n+1][i] = mas[0][i] = mas[i][n+1] = 1;
int dx[] = {0,-1,0,1};
int dy[] = {-1,0,1,0};

int x = n, y =n, d=0;
int sq = n*n;
for(int i=sq; i>=1; i--)
	{
	mas[x][y] = i;
	x+=dx[d];
	y+=dy[d];
	if(mas[x][y]>0)
		{
		x-=dx[d];
		y-=dy[d];
		d = (d+1)%4;
		x+=dx[d];
		y+=dy[d];
		}	
	}
for(int i=1; i<=n; i++)
	{
	for(int j=1; j<n; j++)
		printf("%d ", mas[i][j]);
	printf("%d\n", mas[i][n]);
	}
	
return 0;
}
