r=1..n=gets.to_i;r.map{|j|puts r.map{|i|"%3d".%1+(i+n/2+y=j-i*2)%n+y%n*n}*" "}