main=do n<-readLn;mapM(putStrLn.unwords.map show)$[[]]#[1..n]!!n s#t=s:[a:b|a+1<-t,b<-s,and[d^3/=c^2*d|(c,d)<-zip t$map(a-)b]]#t