main=do n<-readLn;mapM(putStrLn.unwords.map show)$f[0..n-1] f[]=[[]] f x=[a:y|a<-x,y<-f[b|b<-x,b/=a],and$zipWith((/=).abs.(a-))y[1..]]