Problem:


人気の出店は?

 会津若松市では、毎年1月10日に「十日市」という初市があります。この十日市は、約600年の歴史があり会津地方最大の初市です。会津地方ではお馴染みの縁起物である、起き上がり小法師(おきあがりこぼし)が売られていることでもよく知られています。起き上がり小法師は、大きさ3cm 程度の重心が底にある張り子で、転がしてもすぐに起きあがることからこの名前が付きました。各家庭では、必ず家族より一個多く買って神棚に供えます。この一個は、 「家族が増えるように」や「厄を背負ってくれる」との意味があります。

十日市実行委員会では、次回の十日市に向けて、起き上がり小法師の販売個数が一番多い出店を調べることになりました。今年の出店の数は5店(A、B、C、D、E:半角英字)で、販売個数は、午前と午後に分けて十日市実行委員会に報告されています。

各出店の情報を入力とし、一日の販売個数が一番多い出店の名前とその個数を出力するプログラムを作成してください。

Input

複数のデータセットの並びが入力として与えられます。入力の終わりはゼロふたつの行で示されます。
各データセットは以下の形式で与えられます。

s1A s2A
s1B s2B
s1C s2C
s1D s2D
s1E s2E

i 行目に、それぞれA, B, C, D, E の午前の販売個数 s1i と午後の販売個数 s2i (1 ≤ s1i, s2i ≤ 10000) が与えられます。ただし、一日の販売個数が同じ出店は無いものとします。

データセットの数は 100 を超えません。

Output

データセットごとに、一日の販売個数の一番多い出店の名前とその個数を１行に出力します。

Sample Input

1593 4311
4321 2155
1256 6421
5310 1455
2152 5421
1549 3386
4528 3719
1234 4321
3330 3109
2739 2199
0 0

Output for the Sample Input

C 7677
B 8247



Sample input:
1593 4311
4321 2155
1256 6421
5310 1455
2152 5421
1549 3386
4528 3719
1234 4321
3330 3109
2739 2199
0 0


Sample output:
C 7677
B 8247

Submission status: Wrong Answer

Solution code:
while True:
    tt= 0x41
    a,b = map(int,raw_input().split())
    ans = a+b
    if ans == 0: break
    for i in range(4):
        c,d = map(int,raw_input().split())
        if c+d > ans: ans,tt = c+d,tt+1
    print "{} {}".format(chr(tt),ans)

Submission status: Accepted

Solution code:
import sys
f = sys.stdin


import operator
while True:
    a = sum(map(int, f.readline().split()))
    if a == 0:
        break
    abcde = [a] + [sum(map(int, f.readline().split())) for i in range(4)]
    print(*max(zip('ABCDE', abcde), key=operator.itemgetter(1)))

Submission status: Accepted

Solution code:
while True:
    a, b = map(int, raw_input().split())
    if a == b == 0: break
    ex = [0, a+b]
    for i in range(1, 5):
        a, b = map(int, raw_input().split())
        if ex[1] < a+b:
            ex = [i, a+b]
    else:
        if ex[0] == 0:
            print 'A', ex[1]
        elif ex[0] == 1:
            print 'B', ex[1]
        elif ex[0] == 2:
            print 'C', ex[1]
        elif ex[0] == 3:
            print 'D', ex[1]
        else:
            print 'E', ex[1]

Submission status: Accepted

Solution code:
cnt=0
l=[]
while 1:
    n,k=map(int,raw_input().split())
    cnt+=1
    if n==k==0:
        break
    l.append(n+k)
    if cnt%5==0:
        print chr(l.index(max(l))+65),max(l)
        l=[]

Submission status: Accepted

Solution code:
while 1:
    a=sum(map(int,input().split()))
    if a==0:break
    a=[a]+[sum(map(int,input().split())) for _ in range(4)]
    b=max(a)
    print(chr(ord('A')+a.index(b)),b)

Submission status: Accepted

Solution code:
# Aizu Problem 0195: What is the Most Popular Shop in Tokaichi?
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


while True:
    most = 0
    shop = 'A'
    a, b = [int(_) for _ in input().split()]
    if a == b == 0:
        break
    most = a + b
    for s in range(4):
        a = sum([int(_) for _ in input().split()])
        if a > most:
            most = a
            shop = chr(66 + s)
    print(shop, most)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0195

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    while True:
        am, pm = map(int, input().split())
        if am == 0 and pm == 0:
            break
        totals = [0] * 5
        totals[0] = am + pm
        for i in range(1, 5):
            am, pm = map(int, input().split())
            totals[i] = am + pm

        top = max(totals)
        shop = totals.index(top)

        print('{} {}'.format(chr(ord('A')+shop), top))



if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
while True:
    b=[]
    a,c,ans,f,g=0,0,0,0,0
    try:
        for i in range(5):
            f,g=map(int,input().split())
            if f==0 and g==0:
                break
            a=f+g
            b.append(a)
        if a==0 and b==0:
            break
        c=max(b)
        if c==b[0]:
            ans="A"
        if c==b[1]:
            ans="B"
        if c==b[2]:
            ans="C"
        if c==b[3]:
            ans="D"
        if c==b[4]:
            ans="E"
        print(ans,c)
    except:break

Submission status: Accepted

Solution code:
while True:

    input_data = input()

    if input_data == "0 0":
        break

    input_list = [input().split(" ") for _ in range(4)]
    input_list.insert(0, input_data.split(" "))

    input_list = [(int(count1) + int(count2), char) for (count1, count2), char in
                  zip(input_list, ["A", "B", "C", "D", "E"])]

    result = max(input_list)

    print(result[1], result[0])

Submission status: Accepted

Solution code:
# AOJ 0195 What is the Most Popular Shop in Tokaich
# Python3 2018.6.20 bal4u

import sys
while True:
	tbl = {}
	for i in range(5):
		s = sum(list(map(int, input().split())))
		if i == 0 and s == 0: sys.exit()
		tbl[chr(ord('A')+i)] = s
	ans = sorted(tbl.items(), key=lambda x: x[1], reverse = True)
	print(*ans[0])

Submission status: Accepted

Solution code:
dic = {0:"A", 1:"B", 2:"C", 3:"D", 4:"E"}
while True:
  sa = list(map(int, input().split()))
  if sa == [0, 0]:
    break
  lst = [sum(sa)]
  for _ in range(4):
    lst.append(sum(map(int, input().split())))
  print(dic[lst.index(max(lst))], max(lst))

Submission status: Accepted

Solution code:
L=["A","B","C","D","E"]
while True:
    dic={}
    for c in L:
        s1,s2=map(int,raw_input().split())
        if s1==s2==0:break
        dic[s1+s2]=c
    if s1==s2==0:break
    m=max(dic)
    print dic[m],m

Submission status: Accepted

Solution code:
D = "ABCDE"
while True:
    try:
        A = [(D[i],sum(map(int,raw_input().split()))) for i in xrange(5)]
    except:
        break
    print "{} {}".format(*max(A,key=lambda (i,a):a))

Submission status: Accepted

Solution code:
s = "ABCDE*"
while 1:
    m = 0; n = 5;
    for i in xrange(5):
        s1,s2 = map(int, raw_input().split())
        if i==0 and s1==s2==0: break
        if m<s1+s2:
            m = s1+s2; n = i;
    if m==0: break
    print s[n],m

Submission status: Accepted

Solution code:
ref = ["A","B","C","D","E"]
while True:
	try:
		d = sorted([[sum(map(int, raw_input().split())),i] for i in range(5)])[-1]
		print ref[d[1]],d[0]
	except:
		break

Submission status: Accepted

Solution code:
ref = ["A","B","C","D","E"]
while 1:
	try:
		d = max([[sum(map(int, raw_input().split())),i] for i in range(5)])
		print ref[d[1]],d[0]
	except:
		break

Submission status: Accepted

Solution code:
import sys,os
while 1:
    a = []
    for i in range(5):
        a.append(list(map(int, input().split())))
        if a == [[0,0]]:
            sys.exit(0)

    ans = 0
    abcde = "ABCDE"
    an = ""
    for j,i in enumerate(a):
        if ans < i[0]+i[1]:
            ans = i[0]+i[1]
            an = abcde[j]

    print(an,ans)

Submission status: Accepted

Solution code:
S = ["A","B","C","D","E"]
while True:
    L = []
    a,p = map(int,input().split())
    if a == 0:
        break
    L.append(a+p)
    for i in range(4):
        a,p = map(int,input().split())
        L.append(a+p)
    m = max(L)
    s = L.index(m)
    print(S[s],m)

Submission status: Accepted

Solution code:
end = 0
while end == 0 :
    shop = -1
    max_s = 0
    for i in range(5) :
        try :
            s1, s2 = map(int, input().split())
        except EOFError :
            end = 1
            break
    
        if s1 + s2 > max_s :
            max_s = s1 + s2
            shop = i
    
    if shop == 0 :
        shop_name = "A"
    elif shop == 1 :
        shop_name = "B"
    elif shop == 2 :
        shop_name = "C"
    elif shop == 3 :
        shop_name = "D"
    elif shop == 4 :
        shop_name = "E"
    if end == 0 :
        print(shop_name, max_s)

Submission status: Accepted

Solution code:
def solve():
    from sys import stdin
    f_i = stdin
    
    while True:
        s1A, s2A = map(int, f_i.readline().split())
        
        if s1A == 0 and s2A == 0:
            break
        
        sales = [(s1A + s2A, 'A')]
        for shop in 'BCDE':
            cnt = sum(map(int, f_i.readline().split()))
            sales.append((cnt, shop))
        
        cnt, shop = max(sales)
        
        print(f"{shop} {cnt}")

solve()

Submission status: Accepted

Solution code:
try:
    while True:
        num_list = []
        num_di = {}
        
        #リストに数値を格納して１番大きい数を出力する
        for i in range(0,5):
            line = list(map(int,input().split()))
            num_list.append(sum(line))
            num_di[sum(line)] = 65 + i
        num_list.sort()
        print(chr(num_di[num_list[4]]) + " " + str(num_list[4]))

#EOFErrorを検知する
except EOFError:
    pass

Submission status: Accepted

Solution code:
import sys
while True:
    sells=[]
    for i in range(5):
        s1,s2=[int(j) for j in input().split(" ")]
        if s1==0 and s2==0:
            sys.exit()
        sells.append(s1+s2)
    print(chr(ord('A')+sells.index(max(sells))),max(sells))

Submission status: Accepted

Solution code:
while True:
    a1, a2 = map(int, input().split())
    if a1 == 0:
        break
    ans = 'A'
    maxi = a1+a2
    for i in range(1,5):
        x1, x2 = map(int, input().split())
        if x1+x2 > maxi:
            maxi = x1+x2
            ans = chr(ord('A')+i)
    print(ans,maxi)

Submission status: Accepted

Solution code:
while True:
    try:
        n = [[0,"A"],[0,"B"],[0,"C"],[0,"D"],[0,"E"]]
        for i in range(5):
            n[i][0] = sum(list(map(int,input().split())))
        n.sort(reverse = True)
        print(n[0][1],n[0][0])
    except:
        break

Submission status: Accepted

Solution code:

while True:
    T = []
    am, pm = [int(x) for x in input().split()]
    if am == 0 and pm ==0:
        break
    T.append(am+pm)
    for i in range(4):
        am, pm = [int(x) for x in input().split()]
        T.append(am+pm)
    num = sorted(list(enumerate(T)), key=lambda x: -x[1])[0][0]
    print("ABCDEF"[num], T[num])

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	A = ["A","B","C","D","E"]

	while True:
		try:
			n,m = map(int,input().split())
			max_num = n + m
			number = 0

			if n == 0 and m == 0:
				break

			for i in range(4):
				n,m = map(int,input().split())

				if max_num < n + m:
					max_num = n + m
					number = i + 1
			
			print(A[number],max_num)

		except EOFError:
			break

Submission status: Accepted

Solution code:
while True :
  a, p = map(int, input().split())
  if(a == 0 and p== 0) :
    break
  else :
    m = ["A", "B", "C", "D", "E"]
    shop = list()
    shop.append(a + p)
    for i in range(4) :
      a, p = map(int, input().split())
      shop.append(a + p)
    top = max(shop)
    Shop = shop.index(top)
    print(m[Shop], top)

Submission status: Accepted

Solution code:
name = ['A', 'B', 'C', 'D', 'E']
shop = []
  
while True:
    a,b = map(int, input().split())
    if a == 0 and b == 0:
        break
    shop.append(a+b)
    if len(shop) == 5:
        m = max(shop)
        print(name[shop.index(m)], m)
        shop = []

Submission status: Accepted

Solution code:
while 1:
    a = sum(map(int,input().split()))
    if a == 0:break
    a = [a] + [sum(map(int,input().split())) for _ in range(4)]
    b = max(a)
    print(chr(ord('A')+a.index(b)),b)

Submission status: Accepted

Solution code:
store = "ABCDE"

while True:
  s1, s2 = map(int, input().split())
  if s1 == 0 and s2 == 0:
    break
    
  s = store[0]
  ans = s1 + s2
  
  for i in range(4):
    s1, s2 = map(int, input().split())
    if s1 + s2 > ans:
      s, ans = store[i+1], s1 + s2
      
  print(s, ans)

Submission status: Accepted

Solution code:
dic = {0:"A", 1:"B", 2:"C", 3:"D", 4:"E"}
while True:
  sa = list(map(int, input().split()))
  if sa == [0, 0]:
    break
  lst = [sum(sa)]
  for _ in range(4):
    lst.append(sum(map(int, input().split())))
  print(dic[lst.index(max(lst))], max(lst))

Submission status: Accepted

Solution code:
name = ['A', 'B', 'C', 'D', 'E']
shop = []

while True:
    a,b = map(int, input().split())
    if a == 0 and b == 0:
        break
    shop.append(a+b)
    if len(shop) == 5:
        m = max(shop)
        print(name[shop.index(m)], m)
        shop = []

Submission status: Accepted

Solution code:
name=['A','B','C','D','E']
shop = []
while True:
  a,b = map(int,input().split())
  if a == 0 and b == 0:
    break
  shop.append(a+b)
  if len(shop) == 5:
    m = max(shop)
    print(name[shop.index(m)],m)
    shop = []

Submission status: Accepted

Solution code:
while True:
  try:
      A=[]
      for i in range(5):
        s1,s2=map(int,input().split())
        if s1==0 and s2==0:
          break
        s=s1+s2
        A.append(s)
      if s==0:
        break
      for i in range(len(A)):
        if A[i]==max(A):
          if i==0:
            print("A",A[i])
          if i==1:
            print("B",A[i])
          if i==2:
            print("C",A[i])
          if i==3:
            print("D",A[i])
          if i==4:
            print("E",A[i])
  except EOFError:
      break

Submission status: Accepted

Solution code:
while True:
  a,b = map(int,input().split(" "))
  if a == 0 and b == 0: break  
  c,d = map(int,input().split(" "))
  e,f = map(int,input().split(" "))
  g,h = map(int,input().split(" "))
  i,j = map(int,input().split(" "))  

  listsum= [a+b,c+d,e+f,g+h,i+j]
  listsum.sort()
   
  if listsum[-1] == a+b:
    print("A",listsum[-1]) 
  elif listsum[-1] == c+d:
    print("B",listsum[-1]) 
  elif listsum[-1] == e+f:
    print("C",listsum[-1]) 
  elif listsum[-1] == g+h:
    print("D",listsum[-1]) 
  elif listsum[-1] == i+j:
    print("E",listsum[-1])

Submission status: Accepted

Solution code:
name = ['A', 'B', 'C', 'D', 'E']
shop = []

while True:
  a,b = map(int, input().split())
  if a == 0 and b == 0:
    break
  shop.append(a+b)
  if len(shop) == 5:
    m = max(shop)
    print(name[shop.index(m)], m)
    shop = []

Submission status: Accepted

Solution code:
name=['A','B','C','D','E']
shop = []
while True:
 a,b = map(int,input().split())
 if a == 0 and b == 0:
   break
 shop.append(a+b)
 if len(shop) == 5:
   m = max(shop)
   print(name[shop.index(m)],m)
   shop = []

Submission status: Accepted

Solution code:
name = ['A', 'B', 'C', 'D', 'E']
shop = []
 
while True:
    a,b = map(int, input().split())
    if a == 0 and b == 0:
        break
    shop.append(a+b)
    if len(shop) == 5:
        m = max(shop)
        print(name[shop.index(m)], m)
        shop = []

Submission status: Accepted

Solution code:
s = ["A", "B", "C", "D", "E"]
while True:
  a, b = map(int, input().split())
  if a == 0 and b == 0:
    break
  else:
    m = [0 for i in range(5)]
    m[0] = a + b
    for i in range(1, 5):
      aa, bb = map(int, input().split())
      m[i] = aa + bb
    ans = 0
    mm = 0
    for i in range(5):
      if m[i] > mm:
        mm = m[i]
        ans = i
    print(s[ans], mm)

Submission status: Accepted

Solution code:
while True :
  a, b = map(int, input().split())
  if(a == b and b == 0) :
    break
  else :
    S = ["A", "B", "C", "D", "E"]
    shop = list()
    shop.append(a + b)
    for i in range(4) :
      a, b = map(int, input().split())
      shop.append(a + b)
    win = max(shop)
    Shop = shop.index(win)
    print(S[Shop], win)

Submission status: Accepted

Solution code:
store = "ABCDE"

while 1:
    s1, s2 = map(int, input().split())
    if s1 == 0 and s2 == 0:
        break

    s = store[0]
    ans = s1 + s2

    for i in range(4):
        s1, s2 = map(int, input().split())
        if s1 + s2 > ans:
            s, ans = store[i+1], s1 + s2

    print(s, ans)

Submission status: Accepted

Solution code:
num = {0: 'A', 1: 'B', 2: 'C', 3: 'D', 4: 'E'}
while True:
    n = [0] * 5
    for i in range(5):
        s1, s2 = map(int, input().split())
        if s1 == s2 == 0: exit()
        n[i] += s1 + s2
    ans = max(n)
    print(num[n.index(ans)], ans)

Submission status: Accepted

Solution code:
import sys

while True:
    slist = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0}
    for c in 'ABCDE':
        s1, s2 = map(int, input().split())
        if s1 == 0 and s2 == 0:
            sys.exit()
        slist[c] = s1+s2
    print(*sorted(slist.items(), key=lambda x: x[1])[-1])

Submission status: Runtime Error

Solution code:
l=[]
while 1:
    n,k=map(int,raw_input().split())
    cnt+=1
    if n==k==0:
        break
    l.append(n+k)
    if cnt%5==0:
        print chr(l.index(max(l))+65),max(l)
        l=[]