#include<stdio.h>
int main(void)
{
	int s[5],s1,s2,i,temp,j,x;
	while(1){
		scanf("%d %d",&s1,&s2);
		if(s1==0&&s2==0)break;
		s[0]=s1+s2;
		for(i=0;i<4;i++){
			scanf("%d %d",&s1,&s2);
			s[i]=s1+s2;
		}
		for(i=0;i<5;i++){
			for(j=i+1;j<5;j++){
				if(s[i]<s[j]){
					temp=s[i];
					s[i]=s[j];
					s[j]=s[i];
					x=i;
				}
			}
		}
		if(x==0){
			printf("A %d\n",s[0]);
		}
		if(x==1){
			printf("B %d\n",s[0]);
		}
		if(x==2){
			printf("C %d\n",s[0]);
		}
		if(x==3){
			printf("D %d\n",s[0]);
		}
		if(x==4){
			printf("E %d\n",s[0]);
		}
	}
	return 0;
}