mat = Array.new(15){Array.new(15){0}}
readlines.map(&:to_i).each{|n|
  break if n == 0
  n2 = n * n
  n.times{|i|
    n.times{|j|
      mat[i][j] = 0
    }
  }
  ii = 1
  x = n/2+1
  y = n/2
  mat[x][y] = ii
  ii += 1
  x = (x+1) % n
  y = (y+1) % n
  loop do
    break if ii > n2
    if mat[x][y] == 0
      mat[x][y] = ii
      ii += 1
      y = (y+1) % n
    else
      if y == 0
        y = n-1
      else
        y -= 1
      end
    end
    x = (x+1) % n
  end
  n.times{|i|
    n.times{|j|
      printf "%4d", mat[i][j]
    }
    puts
  }
}