using System; using System.Linq; namespace _571 { class Program { static void Main(string[] args) { int[] a = new int[3]; for (int i = 0; i < 3; i++) { int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray(); a[i] = x[0] * 1000 - x[1]; } string[] ret = new string[] { "A","B","C" }; Array.Sort(a,ret); Array.Reverse(ret); for (int i = 0; i < 3; i++) Console.WriteLine(ret[i]); } } }