import Control.Monad

main :: IO ()
main = do
  s1 <- getLine
  if s1 == "0 0"
    then return ()
    else do
      ls <- replicateM 4 getLine
      let ls' = map (sum . map (read :: String -> Int) . words) (s1:ls)
          ls'' = zip ls' ["A","B","C","D","E"]
          ans = solve ls''
      putStrLn ans
      main

solve :: [(Int,String)] -> String
solve ls = toString (foldl1 comp ls)
  where
    toString :: (Int,String) -> String
    toString (a,b) = b ++ " " ++ show a
    comp :: (Int,String) -> (Int,String) -> (Int,String)
    comp (a,b) (c,d)
      | a < c = (c,d)
      | otherwise = (a,b)