using System; using System.Collections.Generic; using System.Linq; class Program { public void Solve() { List> HW = new List>(); HW.Add(new KeyValuePair("A", Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray())); HW.Add(new KeyValuePair("B", Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray())); HW.Add(new KeyValuePair("C", Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray())); foreach (var item in HW.OrderByDescending(x => x.Value[0]).ThenBy(x => x.Value[1])) { Console.WriteLine(item.Key); } } static void Main() { var solver = new Program(); solver.Solve(); } }