data E=T{s::String}|D(E->E) m@main=getLine>>=putStrLn.s.foldl1(#).map(T).words>>m D f#x=f x T"."#x=D$D.(.)(x#).(#) T a#T b=T$'(':a++' ':b++")"