main=interact$f.read f n=unlines[unwords[p$show$mod(i-2*j)n*n+mod(i-j+n`div`2)n+1|j<-[1..n]]|i<-[1..n]] p x@[_,_,_]=x p x=p$' ':x