main=interact f f[a,_,c]=unlines[[[c,' ']!!min(mod x m*mod(x+2*y)m)1|x<-[-y..m*n]]|let n=read[a]-1;m=2*n,y<-[0..n]]