Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
HERE:
	for {
		max := 0
		shop := 'A'
		for i := 0; i < 5; i++ {
			scanner.Scan()
			buf := strings.Split(scanner.Text(), " ")
			a, _ := strconv.Atoi(buf[0])
			b, _ := strconv.Atoi(buf[1])
			if a == 0 {
				break HERE
			}
			if max < a + b {
				max = a + b
				shop = 'A' + int32(i)
			}
		}
		fmt.Println(string(shop), max)
	}
}

C++: #define scanf_s scanf
#include <stdio.h>
#include<iostream>
#include <list>
#include <vector>
#include <iostream>
using namespace std;
#define MAX 101
#define MIN 101
int main()
{
	int A[5], am, pn, maxi = 0;
	char name[] = { "ABCDE" };
	while (1) {
		maxi = 0;
		for (int i = 0; i < 5; ++i) {
			scanf_s("%d %d", &am, &pn);
			if (pn == 0 && am == 0) break;
			A[i] = am + pn;
			if (A[i] > A[maxi]) {
				maxi = i;
			}
		}
		printf("%c %d\n", name[maxi], A[maxi]);
	}

}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<30;

int main() {
  int a,b;
  int i = 0;
  int res, ma = 0;
  while(cin>>a>>b,a+b) {
    if (ma < a + b) {
      ma = a + b;
      res = i;
    }
    ++i;
    if (i==5) {
      i = 0;
      ma = 0;
      printf("%c %d\n", 'A' + res, ma);
    }
  }
}

C++: #include<iostream>
using namespace std;
int main()
{
	int s1,s2,max=0,mise;
	while(1){
		for(int i=1 ; i<=5 ; ++i){
			cin >> s1 >> s2;
			if(s1==0 && s2==0)break;
			if(max<s1+s2){
				max=s1+s2;
				mise=i;
			}
		}
		if(s1==0 && s2==0)break;
		switch(mise){
		case 1:
			cout << "A " << max << endl;
			break;
		case 2:
			cout << "B " << max << endl;
			break;
		case 3:
			cout << "C " << max << endl;
			break;
		case 4:
			cout << "D " << max << endl;
			break;
		case 5:
			cout << "E " << max << endl;
			break;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<map>
using namespace std;

int main(){
  pair<int,char>shop[5];
  int am[5],pm[5];

  while(1){
    cin >> am[0] >> pm[0];
    if(am[0] == 0 && pm[0] == 0)break;

    for(int i=1;i<5;i++){
      cin >> am[i] >> pm[i];
    }
    
    for(int i=0;i<5;i++){
      shop[i].first = am[i] + pm[i];
      shop[i].second = 'A' + i;
    }
  
    sort(shop,shop+5);

    cout << shop[4].second << ' ' << shop[4].first << endl;
  }
  return 0;
}

C++: /* 
 * File:   main.cpp
 * Author: freebsd
 *
 * Created on 2014/08/28, 10:07
 */

#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
    while (true) {
        int s1[5] = {0}, s2[5] = {0};
        
        char store[5] = {'A', 'B', 'C', 'D', 'E'};
        
        char result = 0;
        
        for(int i = 0; i < 5; i++) {
            scanf("%d %d", &s1[i], &s2[i]);
        }
        
        for(int i = 0; i < 5; i++) {
            s1[i] += s2[i];
        }
        
        int i = 0;
        int max;
            
        max = s1[i];
        
        while(true) {           
            if(s1[i] < s1[i + 1]) max = s1[i + 1];
            if((i + 1) == 4) break;
        }
        
        result = store[i];
        
        printf("%c %d", result, max);
    }
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

int main(){
	
	int s1[5], s2[5];
	
	while(true){
		
		cin >> s1[0] >> s2[0];
		
		if(s1[0] == 0 && s2[0] == 0){
			break;
		}
		
		for(int i = 1; i < 5; i++){
			cin >> s1[i] >> s2[i];
		}
		
		int max = 0;
		int ans = 0;
		
		for(int i = 0; i < 5; i++){
			if(max < s1[i] + s2[i]){
				max = s1[i] + s2[i];
				ans = i;
			}
		}
		
		string ans_str = "A";
		
		ans_str[0] = 'A' + ans;
		
		cout << ans_str << " " << max << endl;
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main()
{
    int s1;
    int s2;
    int sum;
    char name;

    while (cin >> s1 >> s2 && s1 && s2){
        sum = s1 + s2;
        name = 'A';
        for (int i = 0; i < 5; i++){
            cin >> s1 >> s2;
            if (s1 + s2 > sum){
                sum = s1 + s2;
                name = (char)('A' + i);
            }
        }
        cout << name << " " << sum << endl;
    }
}

C++: #include<iostream>
using namespace std;int main(){int p[5],tmp,ans=0;char n[5]={'A','B','C','D','E'};while(1){for(int i=0;i<5;i++){cin>>p[i]>>tmp;p[i]+=tmp;if(!p[0])return 0;if(p[ans]<p[i])ans=i;}cout<<n[ans]<<' '<<p[ans]<<endl;}}

C++: #include <bits/stdc++.h>

using namespace std;


int main() {
	int s1, s2, sum, index;

	while (1) {
		cin >> s1 >> s2;
		if (s1 == 0 && s2 == 0) {
			break;
		}

		index = 0;
		sum = s1 + s2;
		for (int i = 1; i < 5; i++) {
			cin >> s1 >> s2;
			if (s1 + s2 > sum) {
				sum = s1 + s2;
				index = i;
			}
		}
		 
		cout << (char)('A' + index) << " " << sum << endl;
	}
	

	return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
#define INF 114514
using namespace std;




int main(){
	while (1) {
		int i = 0, sum = 0, name = 0;
		for (i = 0; i < 5; i++) {
			int a, b;
			cin >> a >> b;
			if (a == 0 && b == 0) return 0;
			if (a + b > sum) {
				sum = a + b;
				name = i + 1;
			}
		}
		if (name == 1) cout << "A " << sum << endl;
		if (name == 2) cout << "B " << sum << endl;
		if (name == 3)cout << "C " << sum << endl;
		if (name == 4) cout << "D " << sum << endl;
		if (name == 5) cout << "E " << sum << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	enum tol { a, b, c, d, e };
	vector<tol>l;
	vector<int>ll;
	int a1, a2;
	while (cin >> a1 >> a2){
		if (a1 == 0 && a2 == 0)break;
		int o[5];
		int oo[5];
		a1 += a2;
		o[0] = a1;
		for (int i = 1; i < 5; i++) {
			cin >> a1 >> a2;
			a1 += a2;
			o[i] = a1;
		}
		for (int i = 0; i < 5; i++)oo[i] = o[i];
		sort(oo, oo + 5);
		if (oo[4] == o[0]) {
			l.push_back(a);
			ll.push_back(o[0]);
		}
		else if (oo[4] == o[1]) {
			l.push_back(b); 
			ll.push_back(o[1]);
		}
		else if (oo[4] == o[2]) { 
			l.push_back(c); 
			ll.push_back(o[2]);
		}
		else if (oo[4] == o[3]) { 
			l.push_back(d);
			ll.push_back(o[3]);
		}
		else if (oo[4] == o[4]) {
			l.push_back(e);
			ll.push_back(o[4]);
		}
	}
	for (int p = 0; p < l.size();p++){
		if (l[p] == a)cout << "A";
		else if (l[p] == b)cout << "B";
		else if (l[p] == c)cout << "C";
		else if (l[p] == d)cout << "D";
		else if (l[p] == e)cout << "E";
		cout << ' ' << ll[p] << endl;
	}
	char ch;
	cin >> ch;
}

C++: #include<iostream>
using namespace std;
int main()
{
  while(true){
    int maxamnt = 0;
    char ans;
    for(int i = 0; i < 5; ++i){
      int bn,an;
      cin >> bn;
      if( bn == 0 ) return 0;
      cin >> an;
      if( maxamnt < an+bn ){
	maxamnt = an+bn;
	ans = 'A' + i;
      }
    }
    cout << ans << ' ' << maxamnt << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int solve(){
    vector<int> p(5,0);
    int t;
    for (int i = 0; i < 10; ++i) {
        cin>>t;
        if(i==1&&t==0)return 1;
        p[i/2]+=t;
    }
    int ans=0;
    int ansn=-1;
    for (int i = 0; i < 5; ++i) {
        if(ans<p[i]){
            ans=p[i];
            ansn=i;
        }
    }
    auto ansc= static_cast<char>('A' + ansn);
    cout<<ansc<<" "<<ans<<endl;
    return 0;
}

int main(){
    while(solve()==0);
    return 0;
}