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<vector>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	vector<int> sell;
	int num1,num2;
	while(1){
		cin>>num1>>num2;
		if(num1==0 && num2==0)break;
		sell.push_back(num1+num2);
		rep(i,4){
			cin>>num1>>num2;
			sell.push_back(num1+num2);
		}
		int ansnum=0,anssum=0;
		for(int i=0;i<sell.size();i++){
			if(sell[i]>anssum){
				anssum=sell[i];
				ansnum=i;
			}
		}
		cout<<(char)(ansnum+'A')<<" "<<anssum<<endl;
		while(!sell.empty()){
			sell.pop_back();
		}
	}
	return 0;
}

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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)

int am[5], pm[5];

void solve() {
  rep(i,4) cin>>am[i+1]>>pm[i+1];
  
  int res = 0, max = am[0]+pm[0];
  rep(i,4) {
    int t = am[i+1]+pm[i+1];
    if (t > max) {
      max = t;
      res = i+1;
    }
  }
  
  char c = 'A'+res;
  cout<<c<<" "<<max<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>am[0]>>pm[0], am[0]||pm[0]) {
    solve();
  }
  return 0;
}

C++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>	// istringstream
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;

#define MP make_pair
#define fastIO	cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c)	for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(); it!=c.end(); ++it)

void solveAndOutput(vector<pair<char, int> > list){
	int max = -1;
	char ansShopName = 'FFF';
	FOR(i, 0, list.size()){
		if (max < list[i].second){
			max = list[i].second;
			ansShopName = list[i].first;
		}
	}
	cout << ansShopName << " " << max << endl;
}

int main(){
	int s1, s2, count = 0;
	char shopName = 'A';
	vector<pair<char, int> > list;
	while (cin >> s1 >> s2, s1&&s2){
		list.push_back(MP(shopName + count, s1 + s2));
		count++;
		if (count == 5){
			solveAndOutput(list);

			list.clear();
			count = 0;
			shopName = 'A';
		}
	}
	return 0;
}

C++: 
#include <iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int a[5],b[5],c[5],i,max=0,num=0;
    string str[5]={"A","B","C","D","E"};
    while(cin>>a[0]>>b[0]){
        if(a[0]==0&&b[0]==0)break;
        for(i=1;i<5;i++){
            cin>>a[i]>>b[i];
        }
        for(i=0;i<5;i++){
            c[i]=a[i]+b[i];
        }
        for(i=0;i<5;i++){
            if(max<c[i]){
            max=c[i];
                num=i;
            }
        }
        cout<<str[num]<<" "<<max<<endl;
        max=0;
    }
    return 0;
}

C++: #include <stdio.h>
int main(){
    int a[5],b[5],top,pos;
    while(true){
        for(int i=0;i<5;i++){
            scanf("%d%d",&a[i],&b[i]);
            if(i==0&&a[i]==0&&b[i]==0)return 0;
            a[i]+=b[i];
            if(i==0){
                pos=0;
                top=a[i];
            }
            else if(a[i]>top){
                top=a[i];
                pos=i;
            }
        }
        printf("%c %d\n",'A'+pos,top);
        
    }
}

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

int main()
{
	int s1, s2;
	
	while (cin >> s1 >> s2, s1 || s2){
		int max = s1, max_n, i = 0;
		for (int i = 1; i < 5; i++){
			cin >> s1 >> s2;
			if (max < s1 + s2){
				max = s1 + s2;
				max_n = i + 'A';
			}
		}
		
		printf("%c %d\n", max_n, max);
	}
	return (0);
}

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

int main() {
  int a, b;
  while (true) {
    int id, maxe = 0;
    for (int i = 0; i < 5; i++) {
      cin >> a >> b;
      if (a == 0 && b == 0) return 0;
      if (maxe < a + b) {
        maxe = a + b;
        id = i;
      }
    }
    cout << "ABCDE"[id] << " " << maxe << "\n";
  }
  return 0;
}

C++: #include "bits/stdc++.h"
#define rep(i,a,n) for(int (i) = (a);(i) < (n);(i)++)
using namespace std;

int main(){
    
    int n,m,memo = 0,memo_c = 0;
    
    while(1){
        cin >> n >> m;
        if(n == 0 && m == 0){
            break;
        }
        else{
            memo = n+m;
            memo_c = 0;
            
            rep(i,1,5){
                cin >> n >> m;
                if(memo < n+m){
                    memo = n+m;
                    memo_c = i;
                }
            }
            
            cout << (char)(memo_c+65) << " " << memo << endl;
            
        }
    }
    return 0;
}

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;
      printf("%c %d\n", 'A' + res, ma);
      ma = 0;
    }
  }
}