x%y=x:y++[x] f a=a:f('+'%('-'<$a)%map('|'%)a) m@main=readLn>>=mapM putStrLn.(f[" "]!!)>>m