def func(square, x = square.size / 2, y = square.size / 2 + 1, num = 1)
  if square[y][x]
    func(square, (x - 1) % square.size, (y + 1) % square.size, num)
  else
    square[y][x] = num
    if num < (square.size ** 2)
      func(square, (x + 1) % square.size, (y + 1) % square.size, num + 1)
    end
  end
end
def main(input = STDIN)
  while (n = input.gets.to_i) != 0
    square = Array.new(n){Array.new(n)}
    func(square)
    puts square.map{|colum|colum.map{|f|f.to_s.rjust(4, " ")}.join}
  end
end
main