m@main=getLine>>=putStrLn.g.map read.words.f>>m f('/':s)=' ':s f(x:s)=x:f s a%b=show$div a$gcd a b g[a,b]=a%b++'/':b%a