package main import ( "bufio" "fmt" "os" "sort" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func Scanner() string { sc.Scan() return sc.Text() } type person struct { n string h int w int } func main() { buf := make([]byte, 0) sc.Buffer(buf, 100000007) sc.Split(bufio.ScanWords) brothers := make([]person, 3) brothers[0].n = "A" brothers[1].n = "B" brothers[2].n = "C" for i := 0; i < 3; i++ { brothers[i].h, _ = strconv.Atoi(Scanner()) brothers[i].w, _ = strconv.Atoi(Scanner()) } sort.Slice(brothers, func(i, j int) bool { return brothers[i].h > brothers[j].h }) sort.Slice(brothers, func(i, j int) bool { if brothers[i].h == brothers[j].h { return brothers[i].w < brothers[j].w } else { return false } }) for i := 0; i < 3; i++ { fmt.Println(brothers[i].n) } }