main=do n<-readLn;mapM putStrLn[unwords[r$take 3$r$" "++show(1+n*mod(y-2*x)n+mod(y-x+div n 2)n)|x<-[1..n]]|y<-[1..n]] r=reverse