def solve square
  n = square.size
  area = n * n
  center = n / 2
  targetx = center
  targety = center + 1
  square[targety][targetx] = 1
  used = 1

  while used < area do
    targetx += 1
    targety += 1
    while !(targetx < n && targety < n && square[targety][targetx] == -1) do
      #1
      if targetx >= n
        targetx = 0
      elsif targetx < 0
        targetx = n - 1
      end

      if targety >= n
        targety = 0
      end

      #2
      if square[targety][targetx] != -1
        targetx -= 1
        targety += 1
      end

    end
    square[targety][targetx] = used + 1
    used += 1
  end
end

def printSquare square
  square.each do |array|
  first = true
    array.each do |i|
      printf " " unless first
      printf "%d", i
      first = false
    end
    printf "\n"
  end
end

while n = $stdin.gets.to_i do
  break if n == 0
  square = Array.new(n).map{Array.new(n, -1)}
  solve square
  printSquare square
end