while n = gets.to_i
  break if n==0
  a = Array.new(n).map{Array.new(n,"0")}
  k = 1
  i = n/2
  j = n/2-1
  while k<=n*n
    i+=1;j+=1
    if i<n && j<n
      if a[i][j]=="0"
        a[i][j]=k.to_s
        k+=1
      else
	j-=2
      end
    end
    if i>=n && j>=n
      i=-1
      j=-1
    elsif i>=n 
      i=-1
      j-=1
    elsif j>=n
      i-=1
      j=-1
    end
  end
  for i in 0..n-1
    for j in 0..n-1
      print(" "*(4-a[i][j].length),a[i][j])
    end
    print("\n")
  end
end
