// Source code from laekov at noip 2015 day1 #define PRID “magic” #include #include #include

using namespace std;

const int maxn = 41;

int n, a[maxn][maxn], px[maxn * maxn], py[maxn * maxn];

int main() { freopen(PRID “.in”, “r”, stdin); freopen(PRID “.out”, “w”, stdout);

memset(a, -1, sizeof(a));
scanf("%d", &n);
px[1] = 1;
py[1] = (n + 1) >> 1;
a[px[1]][py[1]] = 1;
for (int i = 2; i <= n * n; ++ i) {
	if (px[i - 1] == 1 && py[i - 1] < n)
		px[i] = n, py[i] = py[i - 1] + 1;
	else if (py[i - 1] == n && px[i - 1] > 1)
		px[i] = px[i - 1] - 1, py[i] = 1;
	else if (px[i - 1] == 1 && py[i - 1] == n)
		px[i] = 2, py[i] = n;
	else if (a[px[i - 1] - 1][py[i - 1] + 1] == -1)
		px[i] = px[i - 1] - 1, py[i] = py[i - 1] + 1;
	else 
		px[i] = px[i - 1] + 1, py[i] = py[i - 1];
	a[px[i]][py[i]] = i;
}
for (int i = 1; i <= n; ++ i)
	for (int j = 1; j <= n; ++ j)
		printf("%d%c", a[i][j], (j == n) ? 10 : 32);

}