using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { var di = new Dictionary(); for (int i = 0; i < 3; i++) { var d = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); di.Add((char)('A' + i), d[0] * 100 - d[1]); } var s = di.OrderByDescending(x => x.Value); foreach (var i in s) { Console.WriteLine(i.Key); } } }