using System; using System.Linq; struct A { public double[] a; public double v; public A(double[] t) { a = t; v = a[0] / a[1]; } } class Program { static void Main() { int n = int.Parse(Console.ReadLine()); var s = Enumerable.Range(1, n) .Select(_ => new A(Console.ReadLine().Split().Select(double.Parse).ToArray())) .OrderByDescending(x => x.v); foreach (var e in s) Console.WriteLine("{0} {1}", e.a[0], e.a[1]); } }