m@main=getLine>>=putStrLn.head.foldl1(!).map(:[]).words>>m [x]![y]|x/="."=['(':x++' ':y++")"] [y,x,_]!z=read x!(read y!z) x!y=show y:x