main=mapM putStrLn$f"012345" f[x]=[[x]] f s=[z:' ':t|z<-s,t<-f[a|a<-s,a/=z]]