def read_acm; gets.split.map(&:to_i).inject(:+); end


a = []

while a[0] = read_acm and a[0] != 0
  4.times { |i| a[i+1] = read_acm }
  idx = a.index a.max
  puts %w[A B C D E][idx] + " " + a[idx].to_s
  a.clear
end