#include <iostream>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main(void){
	while(1){
		int a,b,c;
		map<int, string, greater<int> > p;
		cin >> b >> c;
		if(b==0 && c==0)break;
		if(a==0)p.insert( pair<int, string>( b+c ,"A") );
		for(a=1;a<5;a++){
			cin >> b >> c;
			if(a==1)p.insert( pair<int, string>( b+c ,"B") );
			if(a==2)p.insert( pair<int, string>( b+c ,"C") );
			if(a==3)p.insert( pair<int, string>( b+c ,"D") );
			if(a==4)p.insert( pair<int, string>( b+c ,"E") );
		}
		map<int, string, greater<int> >::iterator it = p.begin();
		cout << (*it).second << " " << (*it).first << endl;
	}
	return 0;
}