case class F(c:Int,m:Int){ override def toString:String = s"$c $m"; } object Main{ val s = new java.util.Scanner(System.in) def main(args:Array[String]):Unit ={ Array.fill(s.nextInt)(new F(s.nextInt,s.nextInt)).sortBy(o => o.c * -1.0 / o.m).foreach(println); } }