m@main=getLine>>=putStrLn.f>>m f(a:b:c)=min a b:f c f x=x