using System.Linq; using System; public class P { public int a { get; set; } public int b { get; set; } public double v { get; set; } } public class Hello { static void Main() { var n = int.Parse(Console.ReadLine().Trim()); var ps = new P[n]; for (int i = 0; i < n; i++) { string[] line = Console.ReadLine().Trim().Split(' '); var a = int.Parse(line[0]); var b = int.Parse(line[1]); ps[i] = new P { a = a, b = b, v = (double)a / b }; } foreach (var x in ps.OrderByDescending(y => y.v)) Console.WriteLine("{0} {1}", x.a, x.b); } }