using System; using System.Linq; class No571 { static void Main() { int[] better = new int[70]; for (char i = 'A'; i < 'D'; ++i) { var ruler = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray(); ruler[1] = Math.Abs(100 - ruler[1]); better[i] = ruler[0] * 100 + ruler[1]; } for (int i = 0; i < 3; ++i) { var index = Array.IndexOf(better, better.Max()); Console.WriteLine(index); better[index] =0 ; } } }