import scala.io.StdIn.readLine
import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args:Array[String]) = {
    var n = 0
    val b = new ArrayBuffer[String]
    while({n=readLine.trim.toInt;n}!=0) {
      val a = Array.ofDim[Int](n,n)
      var (i,j,m) = (n/2+1,n/2,1)
      a(i)(j) = m
      m += 1
      i += 1
      j += 1
      while(m<=n*n) {
        if(j>=n) j=0 else if(j<0) j=n-1
        if(i>=n) i=0
        if(a(i)(j)!=0) {
          i += 1
          j -= 1
        } else {
          a(i)(j) = m
          m += 1
          i += 1
          j += 1
        }
      }
      b+=a.map(s=>s.map("%4d".format(_)).mkString).mkString("\n")
    }
    println(b.mkString("\n"))
  }
}