import scala.io.StdIn.readLine
import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args:Array[String]) = {
    var s = "0 0"
    val b = new ArrayBuffer[String]
    while({s=readLine.trim;s} != "0 0") {
      val a = ("A",s.split(" ").map(_.toInt).sum) +: Array("B","C","D","E").map{i=>(i,readLine.split(" ").map(_.toInt).sum)}
      val max = a.maxBy(_._2)
      b += max._1 + " " + max._2
    }
    println(b.mkString("\n"))
  }
}