import std.stdio,std.string,std.conv;

int main()
{
	int n;
	int field[16][16];

	while((n = readln.chomp.to!int) != 0)
	{
		foreach(i;0..16)
		{
			foreach(j;0..16)
			{
				field[i][j] = 0;
			}
		}

		int x = n/2;
		int y = n/2+1;
		field[y][x] = 1;

		int count = 2;
		while(true)
		{
			if(count > n*n)
			{
				break;
			}

			x++;
			y++;

			if(x >= n)
			{
				x = 0;
			}
			if(y >= n)
			{
				y = 0;
			}
			if(x < 0)
			{
				x = n-1;
			}
			if(y < 0)
			{
				y = n-1;
			}
			if(field[y][x] == 0)
			{
				field[y][x] = count;
				count++;
			}
			else
			{
				x -= 2;
			}
		}

		foreach(i;0..n)
		{
			foreach(j;0..n)
			{
				writef("%4d",field[i][j]);
			}
			writeln;
		}
	}
	return 0;
}