#include<stdio.h>
int main(void)
{
    int a1,a2,a3,a4,a5,b1,b2,b3,b4,b5,i,c,d;
	scanf("%d %d",&a1,&b1);
	while(1){
	    c=0;
		d=0;
		    if(a1==0&&b1==0) break;
			if(c<a1+b1) c=a1+b1;
		scanf("%d %d",&a2,&b2);
		    if(c<a2+b2) c=a2+b2,d=1;
		scanf("%d %d",&a3,&b3);
		    if(c<a3+b3) c=a3+b3,d=2;
		scanf("%d %d",&a4,&b4);
		    if(c<a4+b4) c=a4+b4,d=3;
		scanf("%d %d",&a5,&b5);
		    if(c<a5+b5) c=a5+b5,d=4;
		if(d==0) printf("A %d\n",c);
		else if(d==1) printf("B %d\n",c);
		else if(d==2) printf("C %d\n",c);
		else if(d==3) printf("D %d\n",c);
		else if(d==4) printf("F %d\n",c);
		scanf("%d %d",&a1,&b1);
	}
	return 0;
}