import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;

void main()
{
	while (1) {
		auto n = readln.chomp.to!int;
		if (!n) break;
		auto area = new int[][](n, n);
		int x = n/2;
		int y = n/2 + 1;
		area[y][x] = 1;
		int cnt = 2;
		while (cnt < n*n+1) {
			x = x + 1 == n ? 0 : x + 1;
			y = y + 1 == n ? 0 : y + 1;
			if (area[y][x] != 0) {
				x = x == 0 ? n - 1 : x - 1;
				y = y + 1 == n ? 0 : y + 1;
			}
			area[y][x] = cnt++;
		}
		foreach (i; 0..n) {
			foreach (j; 0..n) {
				writef("%4d", area[i][j]);
			}
			writeln("");
		}
	}
}