let () = let n = Scanf.scanf "%d\n" (fun x -> x) in let lst = Array.to_list (Array.init n (fun _ -> Scanf.scanf "%d %d\n" (fun a b -> let a' = float_of_int a in let b' = float_of_int b in let x = a' /. b' in (a, b, x)))) in let sort_lst = List.fast_sort (fun (_,_,x) (_,_,y) -> if x < y then 1 else if x > y then -1 else 0) lst in List.iter (fun (a,b,_) -> Printf.printf "%d %d\n" a b) sort_lst