import Data.List f ::[Int]->(Double,Int,Int) f (x:y:[])=((fromIntegral(x)::Double)/(fromIntegral(y)::Double),x,y) f2 ::(Double,Int,Int)->String f2 (_,a,b)=show a++" "++show b main = do e<-getLine es<-getContents let xs=map (map read) (map words (lines es))::[[Int]] mapM_ putStrLn $ map f2 $ reverse $ sort $ map f xs