import java.util.Scanner object Main extends App { val sc = new Scanner(System.in) val n = sc.nextInt var s = Array.fill(n)((sc.nextInt, sc.nextInt)) s.sortWith((o1, o2) => o1._1 * o2._2 > o1._2 * o2._1).foreach(o => println(s"${o._1} ${o._2}")) }