#include <iostream>
#include <iomanip>
using namespace std;
int a[11][11];
int main()
{
int n;
cin >> n;
for (int x = 1, y = 1, tip = 1; tip <= n * n; x++, y++)
{
int a = x; int b = y;
while (a[x][y] == 0 && x <= n) { a[x][y] = tip; tip++; x++; }
while (a[x][y] == 0 && y <= n) { a[x][y] = tip; tip++; y++; }
while (a[x][y] == 0 && x >= 1) { a[x][y] = tip; tip++; x--; }
while (a[x][y] == 0 && y >= 1) { a[x][y] = tip; tip++; y--; }
x = a; y = b;
}
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
cout << setw(3) << a[i][j];
}
cout << endl;
}
}