#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;
}