function solve() n = parse(Int, readline()) d = [] for _ in 1:n a, b = parse.(Int, split(readline())) push!(d, (a/b, a, b)) end sort!(d, rev=true) for (_, a, b) in d println(a, " ", b) end end solve()